diff options
Diffstat (limited to 'tests/run/numpy_cimport_5.pyx')
-rw-r--r-- | tests/run/numpy_cimport_5.pyx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/run/numpy_cimport_5.pyx b/tests/run/numpy_cimport_5.pyx new file mode 100644 index 000000000..2768f2dae --- /dev/null +++ b/tests/run/numpy_cimport_5.pyx @@ -0,0 +1,25 @@ +# mode: run +# tag: warnings, numpy + +from numpy cimport ndarray +# np.import_array not called - should generate warning + +cdef extern from *: + """ + static void** _check_array_api(void) { + return PyArray_API; /* should be non NULL */ + } + """ + void** _check_array_api() + +def check_array_api(): + """ + >>> check_array_api() + True + """ + return _check_array_api() != NULL + + +_WARNINGS = """ +4:0: 'numpy.import_array()' has been added automatically since 'numpy' was cimported but 'numpy.import_array' was not called. +""" |