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