[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

Here is a new patch (issue6108-3.patch) that checks if __str__ has been
overridden and calls PyObject_Unicode(PyObject_Str(self)).

All the tests (including the one with KeyError) in
issue6108_testcase.diff now pass.

If the patch is OK I'll make sure that the tests cover all the possible
cases that I listed and possibly add a few more before the commit.

--
Added file: http://bugs.python.org/file15535/issue6108-3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

> An alternative approach that should work even for the KeyError case is
> for BaseException_unicode to check explicitly for the situation where
> the __str__ slot has been overridden but __unicode__ is still the
> BaseException version and invoke "PyObject_Unicode(PyObject_Str(self))"
> when it detects that situation.

This is even better, I'll try to do it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

Assume the case of e = MyException() (note: 0 args) with a __str__ that
returns a default message. Now, if the message is ascii, str(e) works
and the user see the default message but unicode(e) returns a
not-so-useful empty string.
On the other hand, if __str__ returns a non-ascii string, then it's
wrong in the first place, because str(e) will fail and returning an
empty string with unicode(e) is not going to help.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

I agree the 2.6 implementation creates backwards compatibility problems
with subclasses that only override __str__ that we didn't recognise at
the time.

An alternative approach that should work even for the KeyError case is
for BaseException_unicode to check explicitly for the situation where
the __str__ slot has been overridden but __unicode__ is still the
BaseException version and invoke "PyObject_Unicode(PyObject_Str(self))"
when it detects that situation.

That way subclasses that only override __str__ would continue to see the
old behaviour, while subclasses that don't override either would
continue to benefit from the new behaviour.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Robert Collins

Robert Collins  added the comment:

"2) 0 args, e = MyException(), with overridden __str__:
   py2.5  : str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
   py2.6  : str(e) -> 'ascii' or error; unicode(e) -> u''
   desired: str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
Note: py2.5 behaviour is better: if __str__ returns an ascii string
(including ''), unicode(e) should return the same string decoded, if
__str__ returns a non-ascii string, both should raise an error.
"

I'm not sure how you justify raising an unnecessary error when trying to
stringify an exception as being 'better'.

__str__ should not decode its arguments if they are already strings:
they may be valid data for the user even if they are not decodable (and
note that an implicit decode may try to decode('ascii') which is totally
useless.

__str__ and __unicode__ are /different/ things, claiming they have to
behave the same is equivalent to claiming either that we don't need
unicode, or that we don't need binary data.

Surely there is space for both things, which does imply that
unicode(str(e)) != unicode(e).

Why _should_ that be the same anyway?

--
nosy: +rbcollins

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3932] HTMLParser cannot handle '&' and non-ascii characters in attribute names

2009-12-12 Thread Sérgio

Sérgio  added the comment:

the patch fix parsing in simple tag a with title with  ?! and
accents like this:

 

--
nosy: +sergiomb2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

What you said is only a special case, and I agree that the solution
introduced with r64791 is correct for that. However, that fix has the
side effect of breaking the code in other situations.


To summarize the possible cases and the behaviours I prepared the
following list (odd numbers -> BaseException; even numbers -> any
exception with overridden __str__ and no __unicode__.):
1) 0 args, e = Exception():
   py2.5  : str(e) -> ''; unicode(e) -> u''
   py2.6  : str(e) -> ''; unicode(e) -> u''
   desired: str(e) -> ''; unicode(e) -> u''
Note: this is OK

2) 0 args, e = MyException(), with overridden __str__:
   py2.5  : str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
   py2.6  : str(e) -> 'ascii' or error; unicode(e) -> u''
   desired: str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
Note: py2.5 behaviour is better: if __str__ returns an ascii string
(including ''), unicode(e) should return the same string decoded, if
__str__ returns a non-ascii string, both should raise an error.

3a) 1 str arg, e = Exception('foo'):
   py2.5  : str(e) -> 'foo'; unicode(e) -> u'foo'
   py2.6  : str(e) -> 'foo'; unicode(e) -> u'foo'
   desired: str(e) -> 'foo'; unicode(e) -> u'foo'
Note: this is OK

3b) 1 non-ascii unicode arg, e = Exception(u'föö'):
   py2.5  : str(e) -> error; unicode(e) -> error
   py2.6  : str(e) -> error; unicode(e) -> u'föö'
   desired: str(e) -> error; unicode(e) -> u'föö'
Note: py2.6 behaviour is better: unicode(e) should return u'föö'

4) 1 unicode arg, e = MyException(u'föö'), with overridden __str__:
   py2.5  : str(e) -> error or 'ascii'; unicode(e) -> error or u'ascii'
   py2.6  : str(e) -> error or 'ascii'; unicode(e) -> u'föö'
   desired: str(e) -> error or 'ascii'; unicode(e) -> error or u'ascii'
Note: py2.5 behaviour is better: if __str__ returns an ascii string
str(e) should work, otherwise it should raise an error. unicode(e)
should return the ascii string decoded or an error, not the arg.

5) >1 args of any type, e = Exception('foo', u'föö', 5):
   py2.5  : str(e) ->  "('foo', u'f\\xf6\\xf6', 5)";
unicode(e) -> u"('foo', u'f\\xf6\\xf6', 5)";
   py2.6  : str(e) ->  "('foo', u'f\\xf6\\xf6', 5)";
unicode(e) -> u"('foo', u'f\\xf6\\xf6', 5)";
   desired: str(e) ->  "('foo', u'f\\xf6\\xf6', 5)";
unicode(e) -> u"('foo', u'f\\xf6\\xf6', 5)";
Note: this is OK

6) >1 args of any type, e = MyException('foo', u'föö', 5), with
overridden __str__:
   py2.5  : str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
   py2.6  : str(e) -> 'ascii' or error; unicode(e) -> u"('foo',
u'f\\xf6\\xf6', 5)";
   desired: str(e) -> 'ascii' or error; unicode(e) -> u'ascii' or error;
Note: py2.5 behaviour is better: if __str__ returns an ascii string,
unicode(e) should return the same string decoded, if __str__ returns a
non-ascii string, both should raise an error.

As you can see, your example corresponds just to the case 3b) (now
fixed), but cases 2, 4, 6 are now broken.

Making this list allowed me to come out with a new patch, that seems to
solve all the problems (2, 4 and 6 while leaving 3b as it is now). The
only exception is for KeyError, if we want it to print the repr, then
KeyError_unicode should be implemented, but I think that Python only
calls str() so it's probably not necessary.

Attached new patch that passes all the tests in issue6108_testcase
except for KeyError. Unless you disagree with the 'desired behaviours'
that I listed, this patch should fix the issue.

--
keywords: +needs review
stage: needs patch -> patch review
Added file: http://bugs.python.org/file15534/issue6108-2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

As Antoine said, there's a reason BaseException now implements both
__str__ and __unicode__ and doesn't implement the latter in terms of the
former - it's the only way to consistently support Unicode arguments
that can't be encoded to an 8-bit ASCII string:

>>> str(Exception(u"\xc3\xa0"))
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'ascii' codec can't encode characters in position
0-1: ordinal not in range(128)
>>> unicode(Exception(u"\xc3\xa0"))
u'\xc3\xa0'

For some of the exception subclasses that will always return ASCII (e.g.
KeyError, which calls repr() on its arguments) then defining __unicode__
in terms of __str__ as Ezio suggests will work.

For others (as happened with BaseException itself), the __unicode__
method will need to be a reimplementation that avoids trying to encode
potentially non-ASCII characters into an 8-bit ASCII string.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7489] OS X binary installer for 3.1.1 missing from http://www.python.org/download/

2009-12-12 Thread Mitchell Model

New submission from Mitchell Model :

Is there some reason the OS X installer is missing from
http://www.python.org/download/ but present on
http://www.python.org/download/releases/3.1.1/? Seems it should be in
both places.

--
components: None
messages: 96317
nosy: MLModel
severity: normal
status: open
title: OS X binary installer for 3.1.1 missing from 
http://www.python.org/download/
versions: Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7488] Mac/README continues to refer to 2.6, not 3

2009-12-12 Thread Mitchell Model

New submission from Mitchell Model :

The file Mac/README in the Subversion source continues to refer to 2.6,
not the appropriate version of 3.

--
components: Build
messages: 96316
nosy: MLModel
severity: normal
status: open
title: Mac/README continues to refer to 2.6, not 3
versions: Python 3.0, Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well the obvious problem with this approach is that it won't work if
__str__() returns a non-ascii string. The only working solution would be
to replicate the functioning of __str__() in each __unicode__()
implementation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

> IMO __unicode__ should have the same behaviour as __str__. There's no
> reason to implement two different formatting algorithms.

If BaseException has both the methods they have to be both overridden by
derived exceptions in order to have the same behaviour. The simplest way
to do it is to convert the string returned by __str__ to unicode, as I
did in issue6108.diff.
If you have better suggestions let me know.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7402] reduce() is an anti-example in "Idioms and Anti-Idioms"

2009-12-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Nick Coghlan

Nick Coghlan  added the comment:

Following this down the rabbit hole a little further: Issue #2517 (the
origin of my checkin) was just a restoration of the __unicode__ slot
implementation that had been ripped out in r51837 due to Issue #1551432.

At the time of the r64791 checkin, BaseException_str and
BaseException_unicode were identical aside from the type of object
returned (checking SVN head shows they're actually still identical).

However, it looks like several exceptions with __str__ overrides (i.e.
Unicode[Encode/Decode/Translate]Error_str, EnvironmentError_str,
WindowsError_str. SyntaxError_str, KeyError_str) are missing
corresponding __unicode__ overrides, so invoking unicode() on them falls
back to the BaseException_unicode implementation instead of using the
custom formatting behaviour of the subclass.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7306] Patch - skip winsound tests if no default sound is configured

2009-12-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

You can use unittest.skipUnless instead of skipIf since you have a not
condition in all of them.

--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6654] Add "path" to the xmrlpc dispatcher method

2009-12-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Hi, Kristjan. Could you port your commit to py3?

--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7486] doc: Built-in Functions, exec statement is obsolete

2009-12-12 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r76771.

--
nosy: +benjamin.peterson
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7479] os.lchmod is not present

2009-12-12 Thread steve

steve  added the comment:

Thank you for you explanation of os.lchmod()

Adding a note to the documentation would be very useful.  I did search
the internet for an answer before posting the bug, and I was only able
to find forum posts of other people having the same issue.

Thank you again, peace;
Steve,

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7402] reduce() is an anti-example in "Idioms and Anti-Idioms"

2009-12-12 Thread Christoph Zwerschke

Christoph Zwerschke  added the comment:

My point was that the passage starts with "there are also many useful
built-in functions people seem not to be aware of for some reasons" and
then it looks like the author himself was not aware of sum() for some
reason because he gives calculating a sum with reduce() as a "classical
example".

It's very hard to come up with good examples for reduce() and I think in
newer Python versions it has been demoted from builtin to functools, so
it's not a good example for a useful built-in fuction anyway.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7247] test_fcntl_64_bit from test_fcntl.py fails in Python 2.6.4

2009-12-12 Thread Dror Levin

Changes by Dror Levin :


--
nosy: +spatz

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7487] doc: Code is not always colored

2009-12-12 Thread flox

flox  added the comment:

The bug seems related to Sphynx on Python3.

These examples are NOT colored::

  class Z:
def __init__(self):
  pass

::

  class F:
def __foo__(self):
  pass

::

  class C:
  def method(self):
  pass

  c = C()
  c.method.__func__.whoami = 'my name is c'



While these examples are colored correctly::

  class A:
pass

  class B:
def b(self):
  pass

  class C(): pass

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7487] doc: Code is not always colored

2009-12-12 Thread flox

New submission from flox :

Some code samples are not syntax colored in the doc for Python 3.
In the documentation for Python 2, it is OK.

Example:
  http://docs.python.org/dev/py3k/library/stdtypes.html#methods
  http://docs.python.org/dev/library/stdtypes.html#methods

--
assignee: georg.brandl
components: Documentation
messages: 96306
nosy: flox, georg.brandl
severity: normal
status: open
title: doc: Code is not always colored
versions: Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7481] Failing to start a thread leaves "zombie" thread in "initial" state

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I can reproduce it under Linux using "ulimit -Su 2600".
(deselecting 2.5 as it doesn't receive bug fixes anymore)

--
nosy: +gps, jyasskin, pitrou
priority:  -> normal
stage:  -> needs patch
versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7316] Add a timeout functionality to common locking operations

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Updated patch against py3k.

--
keywords: +needs review
Added file: http://bugs.python.org/file15533/timedlock3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7306] Patch - skip winsound tests if no default sound is configured

2009-12-12 Thread Brian Curtin

Brian Curtin  added the comment:

Removing versions that this wouldn't apply to if it were accepted.

--
versions: +Python 3.2 -Python 2.6, Python 3.0, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7466] Segmentation fault with tuple + gc.collect()

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Committed, thanks!

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7475] codecs missing: base64 bz2 hex zlib ...

2009-12-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> So, after reading the above comments, I think we may end up with
> following changes:
>  * restore the "bytes-to-bytes" codecs in the "encodings" package
>  * then create new helpers on bytes objects (either
>".transform()/.untransform()" or ".encodebytes()/.decodebytes")

I would still be opposed to such a change, and I think it needs a PEP.
If the codecs are restored, one half of them becomes available to
.encode/.decode methods, since the codec registry cannot tell which
ones implement real character encodings, and which ones are other
conversion methods. So adding them would be really confusing.

I also wonder why you are opposed to the import statement. My
recommendation is indeed that you use the official API for these
libraries (and indeed, there is an official API for each of them,
unlike real codecs, which don't have any other documented API).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5949] IMAP4_SSL spin because of SSLSocket.suppress_ragged_eofs

2009-12-12 Thread R. David Murray

R. David Murray  added the comment:

Patch modified to skip ssl tests if ssl not available in r76727 in
trunk; that changeset included in all merges.  p3k merge in r76730 as
stated.  2.6 merge in r76761, using the 2.6 patch provided by Scott. 
3.1 merge in r76762.

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7479] os.lchmod is not present

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Perhaps the top-level module description should just be clearer. Right
now it is not obvious that functions marked "availability: Unix" may
only be available on certain Unix flavours.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7484] smtplib: verify breaks with Postfix servers

2009-12-12 Thread R. David Murray

R. David Murray  added the comment:

I agree.  My reading of the rfc is that the form without the brackets
*must* be supported by the MTA, while any other form is optional.  So
smtplib should use the required form for its VRFY query.  Any MTA that
doesn't recognize that form would be broken.

2.5 is in security-fix-only mode, so this can only be fixed in 2.6 and
above.

--
keywords: +easy
nosy: +r.david.murray
priority:  -> normal
stage:  -> test needed
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 2.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6108] unicode(exception) and str(exception) should return the same message on Py2.6

2009-12-12 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> In r64791, BaseException gained a new __unicode__ method that does the
> equivalent of the following things:

It remains to be seen why that behaviour was chosen. Apparently Nick
implemented it.
IMO __unicode__ should have the same behaviour as __str__. There's no
reason to implement two different formatting algorithms.

--
nosy: +ncoghlan

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7475] codecs missing: base64 bz2 hex zlib ...

2009-12-12 Thread flox

flox  added the comment:

> And this statement was not converted

s/this statement/this method call/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7475] codecs missing: base64 bz2 hex zlib ...

2009-12-12 Thread flox

flox  added the comment:

Martin,

actually, I was trying to convert some piece of code from python2 to
python3. And this statement was not converted by 2to3:
  "x.decode('base64').decode('zlib')"

So, I read the official documentation, and found no hint about the
removal of these codecs.
For my specific use case, I can use "zlib.decompress" and
"base64.decodebytes", but I find that the ".encode()" and ".decode()"
helpers were useful in Python 2.

I don't know all the background of the removal of these codecs. But I
try to contribute to Python, and help Python 3 become at least as
featureful, and useful, as Python 2.

So, after reading the above comments, I think we may end up with
following changes:
 * restore the "bytes-to-bytes" codecs in the "encodings" package
 * then create new helpers on bytes objects (either
   ".transform()/.untransform()" or ".encodebytes()/.decodebytes")

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7396] regrtest single: iterator not subscriptable

2009-12-12 Thread R. David Murray

R. David Murray  added the comment:

Yes, rebinding a variable to a different type is something that is
considered an acceptable pattern in Python programs, at least in certain
circumstances.  Python programs generally use 'duck typing', and a list
and an iterable have equivalent semantics for the purposes of (most of)
the regrtest code.

On the other hand, regrtest is in general *not* an example of good
Python code, and really ought to be cleaned up at some point.  In
particular, the code blocks in regrtest are simply huge, and this makes
changing it very error prone, with "what type is this variable" being
just one example of the coupling problems.

Attached is a patch against trunk.  Please confirm that this fixes the
problems you found.

--
assignee:  -> r.david.murray
components: +Tests
keywords: +patch
stage:  -> patch review
versions:  -Python 2.6, Python 3.1
Added file: http://bugs.python.org/file15532/regrtest_single_issue7396.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7486] doc: Built-in Functions, exec statement is obsolete

2009-12-12 Thread flox

Changes by flox :


--
keywords: +patch
Added file: http://bugs.python.org/file15531/issue7486_doc_py3k.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7486] doc: Built-in Functions, exec statement is obsolete

2009-12-12 Thread flox

New submission from flox :

In the documentation of "compile(...)", there's a mention of the "exec
statement".

--
assignee: georg.brandl
components: Documentation
messages: 96293
nosy: flox, georg.brandl
severity: normal
status: open
title: doc: Built-in Functions, exec statement is obsolete
versions: Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7469] Design and History FAQ entry on Floating Point does not mention short repr.

2009-12-12 Thread R. David Murray

R. David Murray  added the comment:

No, you are right, there's nothing actually inaccurate.  It might be
good for it to say, about repr, that it prints the "minimum number of
digits necessary", which is what is different from the old behavior. 
But I agree that it doesn't *have* to change.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7485] Error in FAQ entry '4.25 Why doesn't Python have a "with" statement for attribute assignments?'

2009-12-12 Thread Eric Smith

New submission from Eric Smith :

The documentation says: "If the referenced object does not have a, b and
c attributes, of course, the end result is still a run-time exception."

For the given example, this is likely not true. Since the attributes are
being assigned to, they will be created. The example is equivalent to:

>>> class a(object): pass
...
>>> ref = a()
>>> ref.a = 21
>>> ref.b = 42
>>> ref.c = 63

--
assignee: georg.brandl
components: Documentation
messages: 96291
nosy: eric.smith, georg.brandl
severity: normal
status: open
title: Error in FAQ entry '4.25   Why doesn't Python have a "with" statement 
for attribute assignments?'
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7469] Design and History FAQ entry on Floating Point does not mention short repr.

2009-12-12 Thread Mark Dickinson

Mark Dickinson  added the comment:

Is there anything actually *wrong* with that FAQ section?  I'm not sure 
how mentioning short float repr would address any particular FAQ.  Unless 
that FAQ is "why do 2.6 and 2.7 give different results?".

I agree that the tutorial section for trunk needs updating.

I also notice that the FAQs for py3k need to be looked at closely:  there 
are a lot of print statements in there, and doubtless some other 2.x-isms.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7479] os.lchmod is not present

2009-12-12 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

If we do that, we would probably need to acknowledge that most functions
in the POSIX module are available only on some Unixes - namely all that
are listed in posix_methods with conditional compilation. That, in turn,
would be silly for things like getcwd where probably only minority
systems (e.g. embedded systems without file system) fail to support it.

I think the problem of this report really originates in the
unfamiliarity of the OP with Unix implementations other than Linux,
rather than in a flaw of the Python documentation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7479] os.lchmod is not present

2009-12-12 Thread Georg Brandl

Georg Brandl  added the comment:

I don't see why we can't start it.  I'd prefer "Some Unices" though,
since you never know when e.g. Linux is going to start supporting e.g.
lchmod().

--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7402] reduce() is an anti-example in "Idioms and Anti-Idioms"

2009-12-12 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, I think the example is fine as-is.  It could be changed to a
product example:  reduce(operator.mul, range(1, n+1)) or somesuch. 
Also, the text could be modified to mention sum().  But it is also fine
if the example is unchanged, it does show how reduce() works.

Recommend closing or just having a very minor edit.

--
assignee: rhettinger -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7396] regrtest single: iterator not subscriptable

2009-12-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +michael.foord, ncoghlan, pitrou, r.david.murray
priority:  -> normal
versions:  -Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7402] reduce() is an anti-example in "Idioms and Anti-Idioms"

2009-12-12 Thread Ezio Melotti

Ezio Melotti  added the comment:

The example alone can't be fixed, because half of the section talks
about how useful reduce() is.
The whole document should IMHO be rewritten, possibly using some of the
examples in
http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html
I already asked to David and he said that the license (CC-BY-SA) allows
to do that.
If you agree to rewrite it and no one else volunteer, I can try to do
it, but I don't know when I'll have time.

--
nosy: +ezio.melotti
priority:  -> low
versions:  -Python 3.0

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7483] str.format behaviour changed from Python 2.6

2009-12-12 Thread Eric Smith

Eric Smith  added the comment:

This is a duplicate of issue 6902. I have a patch for that in the works.

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com