Robert,
If I import numpy and then import a 3rd party extension module, why does the extension module still have to call import_array if numpy sets this array in the first place? I assume that there's a single array of API functions in a single python process with multiple extension modules.
Igor.
On Thu, Jan 1, 2009 at 14:21, Igor Sylvester <igorsyl@gmail.com> wrote:In 3rd party extension modules, all of the PyArray_* API functions are
> I realize I need to call import_array() in the module initialization
> module. Why isn't this equivalent to importing numpy before importing my
> module?
actually #define macros pointing to an array of function pointers.
import_array() imports numpy.core.multiarray and sets up this array.
If you don't do this, then trying to call one of the PyArray_*
functions will result in a segfault because it tries to dereference a
pointer in the array that is not set up.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion