summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2020-05-04 18:40:51 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-05-04 19:25:30 +0200
commit688f703a0b6b1e2c0e8cdc123b73a3fc17916b21 (patch)
tree602a54e5c43c461fbad4ff9ba9ff441960aee87c
parent35a93d1c9f07b7a6ffe6e8da5b059da03d9bb6ef (diff)
downloadcython-cgetter_rewrite.tar.gz
Test fix: avoid depending on whether "nd.shape" requires the GIL or not.cgetter_rewrite
-rw-r--r--tests/run/numpy_parallel.pyx8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/run/numpy_parallel.pyx b/tests/run/numpy_parallel.pyx
index da1444c38..96a60be14 100644
--- a/tests/run/numpy_parallel.pyx
+++ b/tests/run/numpy_parallel.pyx
@@ -21,7 +21,7 @@ def test_parallel_numpy_arrays():
3
4
"""
- cdef Py_ssize_t i
+ cdef Py_ssize_t i, length
cdef np.ndarray[np.int_t] x
try:
@@ -32,10 +32,10 @@ def test_parallel_numpy_arrays():
return
x = numpy.zeros(10, dtype=numpy.int)
+ length = x.shape[0]
- for i in prange(x.shape[0], nogil=True):
+ for i in prange(length, nogil=True):
x[i] = i - 5
for i in x:
- print i
-
+ print(i)