summaryrefslogtreecommitdiffstats
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-05-30 12:12:25 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-05-30 12:12:25 (GMT)
commit813363743d4f46062b1d5149d62252c0e2794289 (patch)
treee560c6e9c8b3b73381f0ae162cd096efa324dd10 /Objects/complexobject.c
parentddac33882b7c51c4b0770fd39adaee33dfcd9a1c (diff)
downloadcpython-813363743d4f46062b1d5149d62252c0e2794289.zip
cpython-813363743d4f46062b1d5149d62252c0e2794289.tar.gz
cpython-813363743d4f46062b1d5149d62252c0e2794289.tar.bz2
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.
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c21
1 files changed, 2 insertions, 19 deletions
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 @@ complex_richcompare(PyObject *v, PyObject *w, int op)
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,