[SciPy-user] segfault when calling PyArray_DescrFromType

Robert Cimrman cimrman3 at ntc.zcu.cz
Thu Feb 9 06:08:50 EST 2006


Martin Wiechert wrote:
> Hi list,
> 
> I'm trying to build an C extension, which uses arrays. It builds, and I can 
> import it  from python, but the very first call to a numpy function
> 
>     ea = (PyObject *) PyArray_DescrFromType (PyArray_INT);
> 
> gives me a segfault.
> 
> I have absolutely no clue, but
> 
> nm -l mymodule.so | grep rray
> 
> gives
> 
> 000026a0 b 
> PyArray_API  /usr/lib/python2.4/site-packages/numpy/core/include/numpy/__multiarray_api.h:316
> 
> and this line reads
> 
> static void **PyArray_API=NULL;
> 
> which looks suspicious to me. Something wrong with my setup.py?
> 
> Any suggestions?
> 
> Regards, Martin.

Such wierd errors can happen when you compile a module with a wrong 
version of numpy headers (that means that PyArray_API function pointers 
can point to different functions than you expect...). At least that is 
what had happened to me not so long ago. Try to clear all old 
numpy/scipy files and rebuild everything.

cheers,
r.




More information about the SciPy-User mailing list