On Tue, Mar 8, 2011 at 9:05 AM, maxw <mwindi...@videotron.ca> wrote:

> As far as I can tell, the python protocol buffer code is not yet
> compatible with python 3.x.  I found a few messages in this discussion
> forum indicating that some people had worked on this, but I saw no
> pointer to actual code.  Are you aware of plans or projects (internal
> to google or otherwise) supporting python 3.x?  If not, are there
> known reasons blocking this?

We're not working on porting it to Python 3.x internally right now as we are
not yet ready to move our own codebase to Python 3. It does need to happen
and I'd like to see it done this year but I have not taken a close look at
it to see what it will take to do the port and I don't believe anyone is
currently lined up to work on it.

At first glance I'd break the task down into the following steps:

1) Port the python code under protobuf/python to be clean for conversion to
3.x using 2to3 and fix it up so that unittests pass on both python 2.4 and
3.1; Start with the inner most modules, doing one at a time. I'm not sure
how difficult this will be as 2.4 compatibility needs to be maintained. We
-might- actually need to fork these into a protobuf/python3 tree if keeping
the code both sane while still compatible with 2.4 is too messy.

2) Fix up the python code generator
protobuf/src/google/protobuf/compiler/python to support generating code for
3.x.  I'd probably start by taking the easy route: adding a --python3_out to
protoc and treading python 3.x as a new language. It is possible to have it
generate code that passes 2to3 and works but that could be too much pain;
writing code dealing with unicode/str/bytes differences that works on < 2.6
that also works right when passed through 2to3 can be a bit too "fun."

3) After the above is done and pure python 3.x protobufs are working and
passing all tests, porting the C++ wrapping extension module under
python/google/protobuf/pyext should be the easiest part.

Any attempts you or anyone else can make on the above would be appreciated.

I suspect it might be a lot easier if we can move the minimum supported
python version up to 2.6.

-Greg  (g...@google.com)

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to