Issue #7845: Make 1j.__le__(2j) return NotImplemented rather than raising TypeError.
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 4821d1e..0e55bc3 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -625,10 +625,8 @@
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))