* Piotr Ożarowski <pi...@debian.org>, 2010-05-28, 13:33:
Which tests can fail on newer Python versions? I though newer Pythons are backward compatible, except Py3k.They are *mostly* compatible, but they cannot be fully 100% backward compatible. Modules and features go through a well defined deprecation cycle, __future__ imports get turned on by default, etc, etc. Why just today we had a discussion in #debian-python about string exceptions(!). Those have been deprecated for at least 3.5 years and yet there's still (what Piotr, 100+?) packages in Debian that still use them.Jakub Wilk found the problem and prepared a list of packages affected: http://people.debian.org/~jwilk/tmp/string-exceptions.ddlist anyone volunteers to check them and report bugs? (string exceptions are not allowed in Python >= 2.6)
Just to clarify: indeed, in Python 2.6 string exceptions have been removed. Attempting to use them raises now a TypeError:
$ python2.5 -c "raise 'eggs'" -c:1: DeprecationWarning: raising a string exception is deprecated Traceback (most recent call last): File "<string>", line 1, in <module> eggs $ python2.6 -c "raise 'eggs'" Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: exceptions must be old-style classes or derived from BaseException, not strThe list includes only packages that uses a string literal as an argument to raise; e.g. I obviously didn't find instances of:
SpamException = 'spam'; raise SpamException, 'eggs'Note that some (most?) of the code which is using string literal exceptions is buggy anyway: you cannot reliably catch such an exception unless you catch everything or rely on Python implementation details.
-- Jakub Wilk
signature.asc
Description: Digital signature