[openstack-dev] Sprint at Pycon: Port OpenStack to Python 3

John Dennis jdennis at redhat.com
Tue Apr 1 13:11:52 UTC 2014


On 04/01/2014 04:40 AM, victor stinner wrote:
> Hi,
> 
> I will organize a sprint to Port OpenStack to Python 3 during 4 days
> at Montreal (Canada) during Pycon Montreal 2014, between April, 14
> (Monday) and April, 17 (Thursday).
> 
> The goal of the sprint is to port OpenStack components and OpenStack
> dependencies to Python 3, send patches to port as much code as
> possible. If you don't know OpenStack, you may focus more on
> OpenStack dependencies (MySQL-python, python-ldap,  websockify, ...).

What are the plans for python-ldap? Only a small part of python-ldap is
pure python, are you also planning on tackling the CPython code? The
biggest change in Py3 is unicode/str. The biggest pain point in the 2.x
version of python-ldap is unicode <--> utf-8 at the API. Currently with
python-ldap we have to encode most every parameter to utf-8 before
calling python-ldap and then decode the result back from utf-8 to
unicode. I always thought this should have been done inside the
python-ldap binding and it was a design failure it didn't correctly
handle Python's unicode objects. FWIW the binding relied in CPython's
automatic encoding conversion which applied the default encoding of
ASCII which causes encoding encoding exceptions, the CPython binding
just never used the correct argument processing in Py_ParseTuple() and
PyParseTupleWithKeywords() which allows you to specify the desired
encoding (the C API for LDAP specifies UTF-8 as does the RFC's).

The Py3 porting work for python-ldap is probably going to have to
address the unicode changes in Py3. If the Py3 port of python-ldap
brings sanity to the unicode <--> utf-8 conversion then that makes a
significant API change between the Py2 and Py3 versions of python-ldap
making calling the python-ldap API significantly different between Py2
and Py3. Does that mean you're also planning on backporting the Py3
changes in python-ldap to Py2 to keep the API more or less consistent?

FWIW I just spent a long time fixing unicode handling for LDAP and the
patches were just merged. I've also dealt with the unicode issue in
python-ldap in other projects (IPA) and have a lot of familiarity with
the problem. Also, unfortunately for the purpose of this discussion will
be off-line for several weeks starting at the end of the day.

-- 
John



More information about the OpenStack-dev mailing list