]> granicus.if.org Git - python/commitdiff
default_3way_compare(): use PyNumber_Check(), rather than testing for
authorGuido van Rossum <guido@python.org>
Tue, 18 Feb 2003 16:40:09 +0000 (16:40 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Feb 2003 16:40:09 +0000 (16:40 +0000)
tp_as_number directly.

Objects/object.c

index 150caac0c66be208a0fbf333d48bb8c7d3db67e5..10877b5e2ddb23b80861c08b8996ef6fe001302e 100644 (file)
@@ -633,12 +633,12 @@ default_3way_compare(PyObject *v, PyObject *w)
        if (w == Py_None)
                return 1;
 
-       /* different type: compare type names */
-       if (v->ob_type->tp_as_number)
+       /* different type: compare type names; numbers are smaller */
+       if (PyNumber_Check(v))
                vname = "";
        else
                vname = v->ob_type->tp_name;
-       if (w->ob_type->tp_as_number)
+       if (PyNumber_Check(w))
                wname = "";
        else
                wname = w->ob_type->tp_name;