Mercurial > cpython-lru_cache-weakref
diff Objects/classobject.c @ 1982:33515485ead0 legacy-trunk
Comparison of two class instances without __cmp__ or __rcmp__ methods
was broken.
| author | Sjoerd Mullender <sjoerd@acm.org> |
|---|---|
| date | Wed, 19 Oct 1994 15:11:52 +0000 |
| parents | 0437738279a8 |
| children | f05b5cd79fbe |
line wrap: on
line diff
--- a/Objects/classobject.c Thu Oct 13 09:11:13 1994 +0000 +++ b/Objects/classobject.c Wed Oct 19 15:11:52 1994 +0000 @@ -523,8 +523,11 @@ object *result; int outcome; result = instancebinop(inst, other, "__cmp__", "__rcmp__"); - if (result == NULL) - return -2; + if (result == NULL) { + /* no __cmp__ or __rcmp__ methods, so use addresses */ + err_clear(); + return inst < other ? -1 : (inst > other ? 1 : 0); + } outcome = getintvalue(result); DECREF(result); if (outcome == -1 && err_occurred())
