diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/number.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c index c37a232f4..53218117a 100644 --- a/numpy/core/src/multiarray/number.c +++ b/numpy/core/src/multiarray/number.c @@ -840,6 +840,12 @@ array_index(PyArrayObject *v) "one element can be converted to an index"); return NULL; } + if (PyArray_NDIM(v) != 0) { + if (DEPRECATE("converting an array with ndim > 0 to an index" + " will result in an error in the future") < 0) { + return NULL; + } + } return PyArray_DESCR(v)->f->getitem(PyArray_DATA(v), v); } #endif |