Issue #7845: Make 1j.__le__(2j) return NotImplemented rather than raising TypeError.

This commit is contained in:
Mark Dickinson 2010-03-13 09:48:39 +00:00
parent ad0ef571b7
commit f673f0c40c
4 changed files with 24 additions and 11 deletions

View file

@ -625,10 +625,8 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
TO_COMPLEX(w, j);
if (op != Py_EQ && op != Py_NE) {
/* XXX Should eventually return NotImplemented */
PyErr_SetString(PyExc_TypeError,
"no ordering relation is defined for complex numbers");
return NULL;
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
if ((i.real == j.real && i.imag == j.imag) == (op == Py_EQ))