Phoenix - Python 3.3

Thanks for answer, Robin.
I have changed the way you advise.

20130503.patch (38.2 KB)

Maxim Kolosov wrote:

Thanks for answer, Robin.
I have changed the way you advise.

In the future please keep separate sets of changes in separate patch files. (In this case the aui and wx.py changes should have been kept separate.)

I've applied the aui patches, with some modifications. Apparently you didn't test with Py2.7 otherwise you probably would have seen that this change doesn't make too much sense.

-import framemanager
+import wx.lib.six as six

···

+
+if not six.PY3:
+ import framemanager
  from .aui_constants import *

which basically says that the framemanager module is not needed when running with Python 2.7. I've changed those imports to be

from . import framemanager

For the wx.py patches this change:

-import cStringIO

+if not wx.lib.six.PY3:
+ from cStringIO import StringIO
+else:
+ from io import BytesIO as StringIO

doesn't work because wx.lib.six hasn't been imported. Also the six module takes care of things like the modules and classes that have changed names or locations. (It is much more than just the six.PY3 boolean.) So the above can be written as:

from wx.lib.six import StringIO

Here is another example, this:

+ if sys.hexversion < 0x03000000:
+ import __builtin__ as builtins
+ else:
+ import builtins

can be done like this:

              from wx.lib.six.moves import builtins

I'll go ahead and commit these patches too since the rest of it looks okay, but please do thoroughly test these changes when you get the next snapshot, and also before submitting future patches.

--
Robin Dunn
Software Craftsman