[Numpy-discussion] numpy, Py_ssize_t, cython and 64 bits python 2.4

Charles R Harris charlesr.harris@gmail....
Sun Nov 9 11:40:56 CST 2008

On Sat, Nov 8, 2008 at 11:55 PM, David Cournapeau <
david@ar.media.kyoto-u.ac.jp> wrote:

> Hi,
>    I took a quick look at two bugs in scipy.spatial and scipy.special,
> linked to cython and 64 bits on python 2.4:
> http://scipy.org/scipy/scipy/ticket/785
> At first, I was confused by the (runtime) error message given by cython;
> Py_ssize_t is a feature added in 2.5. The definition when built against
> python 2.4 is coming from numpy, which defines Py_ssize_t in
> numpy/ndarrayobject, and defines it to an int in that case (as
> recommended in PEP 353).

Let me see if I understand this correctly. For Python < 2.5 the list indices
and such are ints, while for later versions they are Py_ssize_t, which is
larger on 64 bit systems. Meanwhile, Py_intptr_t is large enough to hold a
pointer. So why are these two numbers being mixed? They aren't expected to
have the same size for earlier Python.

The quick fix is to just use ints with a fixme note ;)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081109/aa2707e8/attachment.html 

More information about the Numpy-discussion mailing list