summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-11-10 22:31:02 (GMT)
committerGuido van Rossum <guido@python.org>1994-11-10 22:31:02 (GMT)
commitbb3c5f74069df670eba656e891b59553fc66019a (patch)
tree2584a4acf472c060042bc0d838e015a41567738a /Objects/classobject.c
parentf4838463868cfd88b9ea0ffba6ae279e80f702f2 (diff)
downloadcpython-bb3c5f74069df670eba656e891b59553fc66019a.zip
cpython-bb3c5f74069df670eba656e891b59553fc66019a.tar.gz
cpython-bb3c5f74069df670eba656e891b59553fc66019a.tar.bz2
fix comparison of instances without _-cmp__
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index a395801..7d8a8e9 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -524,14 +524,14 @@ instance_compare(inst, other)
int outcome;
result = instancebinop(inst, other, "__cmp__", "__rcmp__");
if (result == NULL) {
- /* no __cmp__ or __rcmp__ methods, so use addresses */
+ error:
err_clear();
- return inst < other ? -1 : (inst > other ? 1 : 0);
+ return (inst < other) ? -1 : 1;
}
outcome = getintvalue(result);
DECREF(result);
if (outcome == -1 && err_occurred())
- return -2;
+ goto error;
if (outcome < 0)
return -1;
else if (outcome > 0)