[Numpy-discussion] import_array weird behavior
Marc POINOT
Marc.Poinot at onera.fr
Tue Dec 20 05:31:52 EST 2011
Hi all,
I've just changed to cython and old numpy module with a raw C API.
The C module init is removed, and I've put the import_array in the 'pure-cython'
part of the module init. Usual tutorial examples have these lines:
import numpy as NPY
cimport numpy as NPY
NPY.import_array()
But this fails (first numpy API call core dump) in my module, if I put back the
import_array() in the C part of the module everything turns ok again.
Now if I remove again this C API import_array and I write:
import numpy as NPY
cimport numpy as CNPY
CNPY.import_array()
all is ok.
Do I miss something? It sounds good to me to have to separate scopes but
I wonder if it's a common practice with potential side-effects or if it is
the right way to use numpy with cython. And then, what about my core dump?
cython 1.15.1
python 2.7.2
numpy 1.6.1
scons 2.1.0
linux x86 64 with gcc 4.3.4
-MP-
-----------------------------------------------------------------------
Marc POINOT [ONERA/DSNA] Tel:+33.1.46.73.42.84 Fax:+33.1.46.73.41.66
Avertissement/disclaimer http://www.onera.fr/onera-en/emails-terms
More information about the NumPy-Discussion
mailing list