[Numpy-discussion] Fwd: PyArray_DescrConverter segfault

Igor Sylvester igorsyl@gmail....
Thu Jan 1 16:25:21 CST 2009


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.


On Thu, Jan 1, 2009 at 4:11 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Thu, Jan 1, 2009 at 14:21, Igor Sylvester <igorsyl@gmail.com> wrote:
> > 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?
> In 3rd party extension modules, all of the PyArray_* API functions are
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090101/e491a51f/attachment.html 

More information about the Numpy-discussion mailing list