mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue #7845: Make 1j.__le__(2j) return NotImplemented rather than raising TypeError.
This commit is contained in:
parent
ad0ef571b7
commit
f673f0c40c
4 changed files with 24 additions and 11 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue