summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/mapping.c10
-rw-r--r--numpy/core/tests/test_indexing.py4
2 files changed, 7 insertions, 7 deletions
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index fb01f20e3..0b4022874 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -1063,7 +1063,7 @@ array_subscript_fromobject(PyArrayObject *self, PyObject *op)
npy_intp value = PyArray_PyIntAsIntp(op);
if (value == -1 && PyErr_Occurred()) {
/* fail on error */
- PyErr_SetString(PyExc_ValueError,
+ PyErr_SetString(PyExc_IndexError,
"cannot convert index to integer");
return NULL;
}
@@ -1387,7 +1387,7 @@ array_ass_sub(PyArrayObject *self, PyObject *ind, PyObject *op)
npy_intp value = PyArray_PyIntAsIntp(ind);
if (value == -1 && PyErr_Occurred()) {
/* fail on error */
- PyErr_SetString(PyExc_ValueError,
+ PyErr_SetString(PyExc_IndexError,
"cannot convert index to integer");
return -1;
}
@@ -1586,9 +1586,9 @@ _nonzero_indices(PyObject *myBool, PyArrayIterObject **iters)
nd = PyArray_NDIM(ba);
if (nd == 0) {
- PyErr_SetString(PyExc_ValueError,
- "cannot construct index objects "
- "for zero-dimensional array");
+ PyErr_SetString(PyExc_IndexError,
+ "only scalars can be indexed by 0-dimensional "
+ "boolean arrays");
goto fail;
}
diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py
index 76a298059..7b7db02d0 100644
--- a/numpy/core/tests/test_indexing.py
+++ b/numpy/core/tests/test_indexing.py
@@ -70,8 +70,8 @@ class TestIndexing(TestCase):
# Index out of bounds produces IndexError
assert_raises(IndexError, a.__getitem__, 1<<30)
- # Index overflow produces ValueError
- assert_raises(ValueError, a.__getitem__, 1<<64)
+ # Index overflow produces IndexError
+ assert_raises(IndexError, a.__getitem__, 1<<64)
def test_single_bool_index(self):
# Single boolean index