My Experience Porting to CPython 3

I was trying to port our C++ app to python 3, but am sadly not having much luck. I use Tools/freeze/freeze.py to embed the .py sources of the python lib into the application, and also build as many C modules into libpython as possible using Modules/Setup.local.

After porting PyString_AsString() calls to PyBytes_AsString(), and updating a few build scripts to use the new print function, I spent a ton of time debugging lib python trying to figure out why the frozen codecs.py isn’t importing. The marshal module is demarshaling “encodings” and “zipimport” correctly, but fails on the code object for codecs.py. I still can’t figure it out.

So now I just have a bunch of #ifdef statements for the new C++ code and a lot of new files added to my project. Disappointing.

Is it considered foolish to try to get python 3 working with our app? It would appear to be a good idea to get the new interpreter in before we release in a couple of months and our users start writing code for it. But, I’ve read plenty of stuff that says it’s a bad idea right now. Good grief!

By | 2009-12-10T08:35:00+00:00 December 10th, 2009|Uncategorized|3 Comments

3 Comments

  1. Anonymous December 10, 2009 at 1:05 pm - Reply

    You can ask for help on the python-porting mailing-list.

  2. Anonymous December 10, 2009 at 1:05 pm - Reply
  3. Patricio December 10, 2009 at 5:39 pm - Reply

    Hey great, thanks for the link!

Leave A Comment

31 + = 32