[Pyrex] [Cython-dev] Segmentation Fault with -O0

Samuele Kaplun Samuele.Kaplun at cern.ch
Wed Aug 15 18:21:41 CEST 2007


In data mercoledì 15 agosto 2007, Stefan Behnel scribacchiaste dette parole:
> Samuele Kaplun wrote:
>
> Well, have you tried compiling it under Python 2.4? It should work
> out-of-the-box.
>
> Stefan

If I declare with:
ctypedef int Py_ssize_t in the global space, then it's ok, but I'm not sure 
this makes Python/Pyrex/Gcc happy.
Otherwise if import Py_ssize_t with:

cdef extern from "Python.h":
    ctypedef int Py_ssize_t

Then this works only on Python 2.5.

I found a PEP about Py_ssize_t stating that it was introduced after 2.5.0
So for now I've added a macro in a personal .h header with

#include <Python.h>
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#endif

and then I import Py_ssize_t from my header.
Do you think is a proper solution or even the first run should be perfectly 
fine?
Best regards,
	Samuele

-- 
.O.
..O
OOO



More information about the Pyrex mailing list