Issue #5211: Complete removal of implicit coercions for the complex
type. Coercion for arithmetic operations was already removed in
r78280, but that commit didn't remove coercion for rich comparisons.
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 5f26a6a..3577a29 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -787,25 +787,8 @@
Py_complex i, j;
PyObject *res;
- c = PyNumber_CoerceEx(&v, &w);
- if (c < 0)
- return NULL;
- if (c > 0) {
- Py_INCREF(Py_NotImplemented);
- return Py_NotImplemented;
- }
- /* Make sure both arguments are complex. */
- if (!(PyComplex_Check(v) && PyComplex_Check(w))) {
- Py_DECREF(v);
- Py_DECREF(w);
- Py_INCREF(Py_NotImplemented);
- return Py_NotImplemented;
- }
-
- i = ((PyComplexObject *)v)->cval;
- j = ((PyComplexObject *)w)->cval;
- Py_DECREF(v);
- Py_DECREF(w);
+ TO_COMPLEX(v, i);
+ TO_COMPLEX(w, j);
if (op != Py_EQ && op != Py_NE) {
PyErr_SetString(PyExc_TypeError,