summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/numpy/convolve2.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/tutorial/numpy/convolve2.pyx')
-rw-r--r--docs/examples/tutorial/numpy/convolve2.pyx8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/examples/tutorial/numpy/convolve2.pyx b/docs/examples/tutorial/numpy/convolve2.pyx
index be7512fe1..b77b92f53 100644
--- a/docs/examples/tutorial/numpy/convolve2.pyx
+++ b/docs/examples/tutorial/numpy/convolve2.pyx
@@ -1,4 +1,4 @@
-# tag: numpy_old
+# tag: numpy
# You can ignore the previous line.
# It's for internal testing of the cython documentation.
@@ -9,6 +9,12 @@ import numpy as np
# currently part of the Cython distribution).
cimport numpy as np
+# It's necessary to call "import_array" if you use any part of the
+# numpy PyArray_* API. From Cython 3, accessing attributes like
+# ".shape" on a typed Numpy array use this API. Therefore we recommend
+# always calling "import_array" whenever you "cimport numpy"
+np.import_array()
+
# We now need to fix a datatype for our arrays. I've used the variable
# DTYPE for this, which is assigned to the usual NumPy runtime
# type info object.