Hi D'Arcy,

great to see you working on Python 3 porting. It's something I also wanted to tackle, but did not find enough time so far.

However, I noticed the port currently creates a lot of backward incompatibility. The main issue that now under Python 2 we get longs instead of ints, and unicode instead of str. That will certainly break a lot of old code that is using PyGreSQL.

You probably did not run the test_pg.py module which tests the classic module in detail. The other tests are much scarcer and are not sufficient to guarantee that we stay backward compatible.

Os is that different behavior in Python 2by intent? My understanding is that the new version should be fully backward compatible and behave exactly the same under Python 2.

Also, I would like to create a maintenance branch in SVN for the current version, split off from r522 before you started to make changes for modern Python. That branch could then be used to create bugfix or maintenance releases for older Python and Postgres versions. For the trunk we could then make more modern requirements like Python 2.7 or change other things that simplify a unified Python 2+3 version.

In http://trac.vex.net:8000/pgtracker/roadmap we wanted to release the Python 2+3 version as 5.0, is that still the plan? The trunk would then represent "5.x" and I would create the maintenance branch as "4.x".

I see two problematic changesets: r526 where you make changes regarding int/long, and r534, where you make changes regarding str/unicode.

In r526 you replaced occurrences of PyInt with PyLong. That means things like OIDs are returned as longs instead of ints in Python 2 which makes no sense for OIDs, since they are always 32 bit, and it breaks the old behavior.

My suggesting here is that instead of setting

#ifndef IS_PY3K
#define PyLong_FromLong PyInt_FromLong
#endif

and changing all the code, we should do it the other way around:

#ifdef IS_PY3K
#define PyInt_FromLong PyLong_FromLong
#endif

plus a few more of this kind, and then we can leave the code as it was. The code will then happily return ints in both Python 2 and Python 3, which will continue to be real ints in Python 2 and ints of the unified type in Python 3. Everything stays backward compatible.

Regarding r534, it's more problematic. I'll look into it, but want to get your feedback first.

-- Christoph


Am 17.11.2015 um 05:49 schrieb D'Arcy J.M. Cain:
On Tue, 17 Nov 2015 04:46:58 -0000
[email protected] wrote:
Log:
Closer to Python 3.  This compiles under both Python 2 and 3 but unit
tests dump core under 3.

Can someone else take a look at this.  We must be close since it still
works under Python 2.



_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to