mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
fix comparison of instances without _-cmp__
This commit is contained in:
parent
f483846386
commit
bb3c5f7406
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue