Return a NotImplemented exception when comparing Matrix or Vector with other types

This commit is contained in:
wmayer 2012-03-13 08:49:01 +01:00
parent f38e6da3c7
commit f22fc55363
2 changed files with 6 additions and 4 deletions

View File

@ -159,8 +159,9 @@ PyObject* MatrixPy::richCompare(PyObject *v, PyObject *w, int op)
} }
} }
else { else {
PyErr_SetString(PyExc_TypeError, "Cannot compare Matrix with other type"); // This always returns False
return 0; Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
} }
} }

View File

@ -237,8 +237,9 @@ PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op)
} }
} }
else { else {
PyErr_SetString(PyExc_TypeError, "Cannot compare Matrix with other type"); // This always returns False
return 0; Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
} }
} }