Commit eb0d181b authored by Sjoerd Mullender's avatar Sjoerd Mullender

Comparison of two class instances without __cmp__ or __rcmp__ methods

was broken.
parent 24394a78
...@@ -523,8 +523,11 @@ instance_compare(inst, other) ...@@ -523,8 +523,11 @@ instance_compare(inst, other)
object *result; object *result;
int outcome; int outcome;
result = instancebinop(inst, other, "__cmp__", "__rcmp__"); result = instancebinop(inst, other, "__cmp__", "__rcmp__");
if (result == NULL) if (result == NULL) {
return -2; /* no __cmp__ or __rcmp__ methods, so use addresses */
err_clear();
return inst < other ? -1 : (inst > other ? 1 : 0);
}
outcome = getintvalue(result); outcome = getintvalue(result);
DECREF(result); DECREF(result);
if (outcome == -1 && err_occurred()) if (outcome == -1 && err_occurred())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment