[PyQt] PyQt and Python v3

Phil Thompson phil at riverbankcomputing.com
Tue Mar 24 22:07:25 GMT 2009


On Tue, 24 Mar 2009 19:54:05 +0100, Simon Edwards <simon at simonzone.com>
wrote:
> Phil Thompson wrote:
>> The current SIP and PyQt4 snapshots now support Python v3. The build
>> process is exactly the same - just use the right interpreter to run
>> configure.py.
> 
>> I'm still working through the examples - so far they have all run under
>> Python v3 without any changes.
> 
> oh excellent news! I didn't expect to see anything working so soon 
> actually. How much work can we expect for getting Python 2 .sip files 
> working on Python 3? Did you encounter many problems with hand written
> code?

Grep the .sip files for PY_MAJOR_VERSION to see how much version dependent
stuff - not a lot and (I think) mostly to do with __repr__ implementations.

The main thing you will need to do is to identify any function arguments
that should be interpreted as an unencoded byte stream rather than UTF-8
encoded text.

I've tried to be flexible in what string conversions are allowed - it's not
as simple as mapping QString to a v3 string object and char * to a v3 bytes
object. I've come to the conclusion that it is a fairly easy task to write
code that will run under v2.6 and v3.x without change.

Phil


More information about the PyQt mailing list