[Numpy-discussion] CAPI segfault running python embedded

David Cournapeau david at ar.media.kyoto-u.ac.jp
Fri Jun 20 09:08:45 EDT 2008


Lane Brooks wrote:
> I have successfully written several extension modules that use the numpy 
> CAPI to manipulate numpy arrays.  I have to say numpy is great.
>
> I am now having a problem, however, when calling numpy capi functions 
> when running python embedded in a third party, closed source, 
> application.  It segfaults whenever I make any PyArray* function call.  
> Any ideas on why that might be happening?
>   

You most likely forgot to call import_array functions when initializing 
your extension (the PyMODULE_INIT function): with python, extensions 
which define new C-API does it through an array of function pointers, 
which is garbage before you call import_array. I have never used 
embedded python, so I don't know how initialization works there, but 
that should be similar I guess.

cheers,

David



More information about the NumPy-Discussion mailing list