From: Guido van Rossum Date: Thu, 22 Feb 2001 22:18:04 +0000 (+0000) Subject: In try_3way_to_rich_compare(), swap the call to default_3way_compare() X-Git-Tag: v2.1b1~227 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2da0ea82ba0c817013fca1442d14ee3596f03bcb;p=python In try_3way_to_rich_compare(), swap the call to default_3way_compare() and the test for errors, so that an error in the default compare doesn't go undetected. This fixes SF Bug #132933 (submitted by effbot) -- list.sort doesn't detect comparision errors. --- diff --git a/Objects/object.c b/Objects/object.c index a4c9f087aa..eff6d7ad07 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -777,10 +777,10 @@ try_3way_to_rich_compare(PyObject *v, PyObject *w, int op) PyObject *result; c = try_3way_compare(v, w); - if (c <= -2) - return NULL; if (c >= 2) c = default_3way_compare(v, w); + if (c <= -2) + return NULL; switch (op) { case Py_LT: c = c < 0; break; case Py_LE: c = c <= 0; break;