[Numpy-discussion] segv PyArray_Check

Burlen Loring bloring at lbl.gov
Wed Nov 13 20:21:19 EST 2013


Hi,

I'd like to add numpy support to an existing code that uses swig. I've 
changed the source file that has code to convert python lists into 
native data from c to c++ so I can use templates to handle data 
conversions. The problem I'm having is a segfault on PyArray_Check 
called from my c++ source. Looking at things in the debugger the 
argument passed to it is indeed an intialized python list, my swig file 
has import_array() in it's init, and I've verified that it is getting 
called. adding a function in my c++ source to call import_array() a 
second time prevents the segfault. Could anyone explain why I need the 
import_array() in both places? If that's the correct way to handle it?

Thanks
Burlen



More information about the NumPy-Discussion mailing list