[Python-Dev] No 2.x->3.x porting documentation?

"Martin v. Löwis" martin at v.loewis.de
Mon Feb 16 10:29:46 CET 2009


> I'm making a naive stab at converting nose to Python3 so I can hopefully run
> the lockfile test cases under Python 3.  (Again, I'm offline and have no
> idea at this point if it's been done already.)  I ran 2to3 then tried
> installing.  I got an immediate error about the compiler.consts module being
> missing.  (All nose does is import CO_GENERATOR from compiler.consts.)  I
> found that in the inspect module.  Then it complained about ClassType being
> missing from the types module.  I found no mention of changes to the types
> module in Misc/NEWS or Doc/whatsnew/3.0.rst.  I didn't find anything which
> looked like a "porting" document.
> 
> If neither of these changes could be handled by 2to3 I think it would have
> been useful to at least document the changes (in whatsnew/3.0.rst?) and
> maybe offer humans some workaround ideas.  If there is a wiki page
> collecting porting wisdom it should be referenced.  If I'm missing something
> fundamental about how people are expected to approach porting 2.x code to
> 3.x, please let me know.

I think you are missing the fact that it is nearly impossible to produce
a complete list of changes between 2.x and 3.x, or, if such a list would
be produced, it would have the size of the unified diff between the
source trees.

Instead, porters are expected to think a bit on what might have been the
most natural cause for a change (of course, some changes are arbitrary
and have no cause other than personal taste). For example, ClassType
used to be the type of old-style classes. Now that old-style classes are
gone, ClassType is gone as well (FWIW in 59217, and indeed without a
mentioning in NEWS, or even in the commit message). The removal of the
compiler package is mentioned in NEWS:

http://svn.python.org/view/python/branches/p3yk/Misc/NEWS?rev=55322&view=markup

Regards,
Martin


More information about the Python-Dev mailing list