Notes on 2.2's changes

A.M. Kuchling akuchlin at crystal.mems-exchange.org
Thu Apr 11 11:14:58 EDT 2002


I'd like to provide a point of view on how many changes 2.2 required
in a sizable amount of code.

The MEMS Exchange codebase I work with is, as of today, 171,437 lines
of Python code.  Looking through the CVS logs, I find the following
messages relating to Python 2.2:

In Grouch:
===============
Tweak is_instance_object to (hopefully) work with Python 2.2.

Fixed InstanceType._check_attrs() so it doesn't blow up on encountering
an instance with no __dict__.  (vars() in Python 2.2 raises an exception
in this situation.)

Modified AtomicType so the 'type' attribute can be None until it's
actually needed, ie. in get_type() and check_value().  This lets me
completely jettison most of the complicated pickle-support code -- no
more _fixup_atomic_types() methods, and (more importantly) no more tests
failing under Python 2.2.  (The code was equally broken under 2.1, it
was just hidden because of blind luck; a change in dictionary order
revealed it under 2.2.)
 
Fix InstanceType._check_attrs() to use vars() instead of dir() to fetch
the list of actual instance attributes.  This fixes one of the
incompatibilities between Grouch and Python 2.2.

Split a couple of tests up so that failures (caused by type name changes
in Python 2.2) are easier to read.
===============

In Quixote's:
===============
(ptl_compile.py)
Support Python 2.2.  (Changes the .ptlc magic number, and adds a 
                      version-specific check for a change to the
                      compiler package.) 

doc/INSTALL:
Complicate instructions for installing the compiler package, since
doing so is only necessary for 2.0 <= Python < 2.2.
Simplify installation instructions for Quixote itself.
===============

In the rest of our application code:
===============
Rename __debug__ to DEBUG for 2.2 compat. 

Removed private copy of asyncore.py; 2.2 contains the needed fixes
===============

And that's it.  Only one application code change, the __debug__ one,
would have actually prevented code from running with a SyntaxError,
and that's only because the file was only previously run under 1.5.2
(so it was going straight from 1.5.2 to 2.2, missing the intermediate
releases where assigning to __debug__ caused a warning). The Quixote
change was to the module that parses PTL and outputs Python bytecode
from the parse tree.  Grouch had the most changes, but it does
introspection on Python objects and types, so it's not surprising that
2.2 caused some upheaval.

Looking at the changes required for 2.0 and 2.1, Quixote again took
the most work.  The actual application code had one or two
multi-argument .append() calls, and that was the extent of the fixes.

This means that from my point of view Python *has* been managed for
stability, and the job has been done reasonably well.  (I'd be
interested in seeing a similar list from people who find there's too
much change.  It would be useful for figuring out what sorts of
changes cause the most problems.)

--amk                                                             (www.amk.ca)
I tolerate this century but I don't enjoy it.
    -- The Doctor, in "An Unearthly Child"



More information about the Python-list mailing list