[Python-Dev] Py3k DeprecationWarning in stdlib

Nick Coghlan ncoghlan at gmail.com
Wed Jun 25 00:05:21 CEST 2008

Benjamin Peterson wrote:
> On Tue, Jun 24, 2008 at 11:42 AM, Guido van Rossum <guido at python.org> wrote:
>> The same generic warning against sweeping changes applies here though.
>> You have to manually review each change. The stdlib and especially the
>> test suite is likely to break if you just let 2to3 run over it, even
>> just a single fixer like fix_has_key.
> So be it. We'll go over each module individually as with #3189.

We need to be especially careful with the unit test suite itself - 
changing the test code to avoid the warning will normally be the right 
answer, but when the code is actually setting out to test the deprecated 
feature we need to suppress the warning in the test suite instead.

I should have a decent amount of Python time available later this 
week/weekend, so I should be able to help with this once I get the 
updated docs for special method lookup knocked over as well as checking 
in the somewhat related fix for the following 2.5 behaviour:

 >>> print unicode(Exception)
<type 'exceptions.Exception'>
 >>> print unicode(u"\xa3")
 >>> print unicode(Exception(u"\xa3"))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in 
position 0: ordinal not in range(128)

(The idea being to get that last line printing the same thing as the 
second line, just as unicode(Exception("A")) produces the answer u"A", 
but without breaking the current behaviour of the first line)


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list