-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Re: Python 2.5 compatibility
On Jul 28, 2006, at 8:57 AM, Barry Warsaw wrote:
+1. It would give me more type to port and test a few of my
applications to the new version.I'm still working on Mailman but the most painful thing so far has
been the conversion of exceptions to new-style classes, and even
that wasn't /too/ painful.
I believe I've finished porting Mailman to Python 2.5. None of the
issues were insurmountable, but here they are FTR:
- Exceptions are new-style classes but Mailman was doing one
specific test against the type of an object to see if it needed to be
instantiated. This test was written as:
if isinstance(obj, ClassType)
which fails in Python 2.5. I actually rewrote it like so:
if isinstance(obj, ClassType) or isinstance(obj, type(type))
in MM2.1 because it has to be backward compatible to Python 2.1.
There was one place where I was commonly raising a string and that
generates deprecation warnings, so I changed that to a class. There
are a few other legacy string exceptions defined in the code, but
they are rarely used and should all get rewritten as well.Cookie.py's repr changed so that trailing semicolons are no longer
output on the end of text lines. I understand this change was made
so that Python cookies were more RFC compliant, but it broke some
homegrown cookie text splitting we were doing. I changed this code
to split on lines first.
All in all, not too bad although the Cookie.py change took a while to
track down!
- -Barry
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin)
iQCVAwUBRM0MDnEjvBPtnXfVAQJ9ZAP/VdtM79SXgx7s/X0aEIu4HDZva7TkYyi6 dRzlgAtEV5BN1yYn+vzw8PBCtdy+9N3yYtv/zqdQP54mZDjsaGaNw6MiS0jsETRy 248hj3otL/00WTrKWh8/OvDlLW8KUNQI4MWBOMKJ/TqYW5Es4fJGEMtbO/xqGXXD /wgWmmLOOAE= =Mu8m -----END PGP SIGNATURE-----