summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Kirkham <kirkhamj@janelia.hhmi.org>2016-01-09 16:26:40 -0500
committerJohn Kirkham <kirkhamj@janelia.hhmi.org>2016-01-15 14:54:20 -0500
commit5fc07a2f5357a638a979abfae9f208784a00a5d7 (patch)
tree32db283d17a158dd532014590b02161da3d72ecc
parentaa6335c494e4807d65404d91e0e9d25a7d2fe338 (diff)
downloadnumpy-5fc07a2f5357a638a979abfae9f208784a00a5d7.tar.gz
MAINT: Ensure `inner` is raising a ValueError just as `dot` does in the same case.
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c3
-rw-r--r--numpy/core/tests/test_multiarray.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index 2c17ebe09..1df3d653d 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -827,6 +827,7 @@ PyArray_InnerProduct(PyObject *op1, PyObject *op2)
typenum = PyArray_ObjectType(op2, typenum);
typec = PyArray_DescrFromType(typenum);
if (typec == NULL) {
+ PyErr_SetString(PyExc_TypeError, "Cannot find a common data type.");
goto fail;
}
@@ -912,7 +913,7 @@ PyArray_MatrixProduct2(PyObject *op1, PyObject *op2, PyArrayObject* out)
typenum = PyArray_ObjectType(op2, typenum);
typec = PyArray_DescrFromType(typenum);
if (typec == NULL) {
- PyErr_SetString(PyExc_ValueError, "Cannot find a common data type.");
+ PyErr_SetString(PyExc_TypeError, "Cannot find a common data type.");
return NULL;
}
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index c9e610cbf..26617c1fc 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -2045,7 +2045,7 @@ class TestMethods(TestCase):
c = 1.
A = np.array((1,1), dtype='i,i')
- assert_raises(ValueError, np.dot, c, A)
+ assert_raises(TypeError, np.dot, c, A)
assert_raises(TypeError, np.dot, A, c)
def test_diagonal(self):