summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/mapping.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index 990f95d3b..254fa9117 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -1576,6 +1576,14 @@ _nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)
return -1;
}
nd = PyArray_NDIM(ba);
+
+ if (nd == 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "cannot construct index objects "
+ "for zero-dimensional array");
+ goto fail;
+ }
+
for (j = 0; j < nd; j++) {
iters[j] = NULL;
}
@@ -1614,6 +1622,7 @@ _nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)
}
/*
+
* Loop through the Boolean array and copy coordinates
* for non-zero entries
*/