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

Stefan Behnel stefan_ml at behnel.de
Thu Aug 9 18:48:21 CEST 2007



Samuele Kaplun wrote:
>> When I compile everything without optimization (-O0) it always crashes
>> after exiting from __new__.
>> I tried to selectively commenting-out the code and I found that the
>> incriminated row is:
>> 		PyObject_AsReadBuffer(tmp, &buf, &size)
>> But I really don't know why.
>> The most interesting thing, is that it never segfaults when compiled with
>> -02 or -03.
>> If checked this with latest Cython & Pyrex and I obtain the same behaviour.
>>
> Some additional information: I run the tests with gcc-3.4.6, 4.1.2 and 4.2.0, 
> with the same behaviour (crash with -O0, -O, no crash with -O2, -O3), on an 
> amd64 machine and Python 2.5. It never crash on gcc-3.x on 32bits.

How did you declare the function? Did you use Py_ssize_t for the size parameter?

Stefan



More information about the Pyrex mailing list