[Python-porting] A few questions about the psycopg2 porting to Python 3

"Martin v. Löwis" martin at v.loewis.de
Wed Jan 12 21:27:16 CET 2011
> I understand there is no problem in using parts of the
> Python (2.7) source code into an LGPL-licensed work: is this right?
> The resulting file is in <http://tinyurl.com/4w5oogn> and includes the
> Python license as well: I'd like an opinion about whether the result
> is "legal" and/or if the license had to be specified some other way.

I can certainly offer an opinion. Not as a PSF director, but as a legal
layman: this sounds all fine to me.

> 
> As emerged from the discussion in this ML back in 2008, there is
> somewhere the need for a python function b('literal') that would
> evaluate to 'literal' in Py2 and to b'literal' in py3 (we want to keep
> compatibility with Python 2.4). Currently there is an encode()
> involved in Py3, so it would be great to have the transformation
> b('literal') -> b'literal' performed by 2to3 instead. Looking at the
> other fixers it seems easy, but I haven't found how to register a
> custom fixer for the use of build_py_2to3 in setup.py. Is there any
> reference?

See the source of distutils.util.Mixin2to3. Overriding fixer_names
should do the trick. The default list is computed as

    get_fixers_from_package('lib2to3.fixes')

and you'll have to append to this list.

I'm glad this has progress!

Regards,
Martin


More information about the Python-porting mailing list