]> granicus.if.org Git - python/commitdiff
In try_3way_to_rich_compare(), swap the call to default_3way_compare()
authorGuido van Rossum <guido@python.org>
Thu, 22 Feb 2001 22:18:04 +0000 (22:18 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 22 Feb 2001 22:18:04 +0000 (22:18 +0000)
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.

Objects/object.c

index a4c9f087aa5bf2e10252dcfb5f67470e389d4209..eff6d7ad072ac37a642076fd5e1e0fd4fda803b7 100644 (file)
@@ -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;