On Sat, Aug 8, 2009 at 13:19, Hanno Schlichting <ha...@hannosch.eu> wrote:
> One thing to note here is that the above change is indeed only of of
> probably many that need to be made to support 64-bit platforms
> properly. The other thing to note is that the change now introduces a
> hard requirement on Python 2.5 or later.
> Neither Martijn nor me could figure out a way to make the function
> calls to Build have different format identifier arguments dependent on
> the Python version. On Python 2.4 there is only "i" for integer and
> 2.5 introduces "n" for Py_ssize_t. Since this is an argument to a
> function showing up in various combinations of "nn", "nO" and others,
> there seems to be no easy way to make this work.
> Someone with more knowledge about pre-processor tricks might come up
> with a solution to this, otherwise we will have to choose between
> dropping 64-bit support or dropping the unofficial Python 2.4 support.

It turned out to be really simple as consecutive string literals are
concatenated into one after macros are expanded. The following
changeset should make Acquisition python 2.4 compatible again and also
properly 64-bit capable:


To summarize: when passing Py_BuildValue a Py_ssize_t value to build a
python int, you need to use the 'n' format string instead of 'i'. But
because 'n' and Py_ssize_t are both defined as of python 2.5, for C
code to work in python 2.4 you need to redefine these two back to 'i'
and int.

Martijn Pieters
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to