summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cython/Utility/NumpyImportArray.c2
-rw-r--r--tests/run/numpy_import_array_error.srctree2
2 files changed, 2 insertions, 2 deletions
diff --git a/Cython/Utility/NumpyImportArray.c b/Cython/Utility/NumpyImportArray.c
index aa8a18fea..a74a38aca 100644
--- a/Cython/Utility/NumpyImportArray.c
+++ b/Cython/Utility/NumpyImportArray.c
@@ -8,7 +8,7 @@
* add the line
* <void>numpy._import_array
*/
-#ifdef NPY_NDARRAYOBJECT_H /* numpy headers have been included */
+#ifdef NPY_FEATURE_VERSION /* This is a public define that makes us reasonably confident it's "real" Numpy */
// NO_IMPORT_ARRAY is Numpy's mechanism for indicating that import_array is handled elsewhere
#if !NO_IMPORT_ARRAY /* https://docs.scipy.org/doc/numpy-1.17.0/reference/c-api.array.html#c.NO_IMPORT_ARRAY */
if (unlikely(_import_array() == -1)) {
diff --git a/tests/run/numpy_import_array_error.srctree b/tests/run/numpy_import_array_error.srctree
index 9f2c286f1..f4589ed2c 100644
--- a/tests/run/numpy_import_array_error.srctree
+++ b/tests/run/numpy_import_array_error.srctree
@@ -18,7 +18,7 @@ setup(ext_modules = cythonize('cimport_numpy.pyx'))
cdef extern from *:
"""
- #define NPY_NDARRAYOBJECT_H
+ #define NPY_FEATURE_VERSION
static int _import_array(void) {
PyErr_SetString(PyExc_ValueError, "Oh no!");
return -1;