Skip to content

Commit

Permalink
MAINT: Ensure inner is raising a ValueError just as dot does in t…
Browse files Browse the repository at this point in the history
…he same case.
  • Loading branch information
jakirkham committed Jan 15, 2016
1 parent aa6335c commit 5fc07a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion numpy/core/src/multiarray/multiarraymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2045,7 +2045,7 @@ def test_dot_type_mismatch(self):
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):
Expand Down

0 comments on commit 5fc07a2

Please sign in to comment.