summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-09-27 20:30:07 (GMT)
committerGuido van Rossum <guido@python.org>2001-09-27 20:30:07 (GMT)
commit2ed6bf87c9ce5d2e8a0eb33f7aa6503196205a0c (patch)
treecb597e3c84bf6d845c849e5d715a011922337704 /Objects/object.c
parent33f4d6d1db5dd915cce811bd6f7a963d4dbe8db2 (diff)
downloadcpython-2ed6bf87c9ce5d2e8a0eb33f7aa6503196205a0c.zip
cpython-2ed6bf87c9ce5d2e8a0eb33f7aa6503196205a0c.tar.gz
cpython-2ed6bf87c9ce5d2e8a0eb33f7aa6503196205a0c.tar.bz2
Merge branch changes (coercion, rich comparisons) into trunk.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 6d7a5e9..88fa340 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -365,6 +365,14 @@ try_rich_compare(PyObject *v, PyObject *w, int op)
richcmpfunc f;
PyObject *res;
+ if (v->ob_type != w->ob_type &&
+ PyType_IsSubtype(w->ob_type, v->ob_type) &&
+ (f = RICHCOMPARE(w->ob_type)) != NULL) {
+ res = (*f)(w, v, swapped_op[op]);
+ if (res != Py_NotImplemented)
+ return res;
+ Py_DECREF(res);
+ }
if ((f = RICHCOMPARE(v->ob_type)) != NULL) {
res = (*f)(v, w, op);
if (res != Py_NotImplemented)