Mercurial > cpython-lru_cache-weakref
diff Objects/classobject.c @ 2001:f05b5cd79fbe legacy-trunk
fix comparison of instances without _-cmp__
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 10 Nov 1994 22:31:02 +0000 |
| parents | 33515485ead0 |
| children | de49d49044d7 |
line wrap: on
line diff
--- a/Objects/classobject.c Thu Nov 10 22:29:04 1994 +0000 +++ b/Objects/classobject.c Thu Nov 10 22:31:02 1994 +0000 @@ -524,14 +524,14 @@ 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)
