summaryrefslogtreecommitdiff
path: root/numpy/lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/src')
-rw-r--r--numpy/lib/src/_compiled_base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c
index 57a641b8c..58b9f5ecd 100644
--- a/numpy/lib/src/_compiled_base.c
+++ b/numpy/lib/src/_compiled_base.c
@@ -683,8 +683,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims,
j = *(npy_intp *)coords[i];
switch (modes[i]) {
case NPY_RAISE:
- if (j < 0 || j >= m)
+ if (j < 0 || j >= m) {
invalid = 1;
+ goto end_while;
+ }
break;
case NPY_WRAP:
if (j < 0) {
@@ -717,12 +719,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims,
coords[i] += coords_strides[i];
}
- if (invalid) {
- break;
- }
*(npy_intp *)coords[ravel_ndim] = raveled;
coords[ravel_ndim] += coords_strides[ravel_ndim];
}
+end_while:
NPY_END_ALLOW_THREADS;
if (invalid) {
PyErr_SetString(PyExc_ValueError,