]> granicus.if.org Git - python/commitdiff
Rich comparisons fall-out:
authorGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 15:29:42 +0000 (15:29 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 17 Jan 2001 15:29:42 +0000 (15:29 +0000)
- Renamed Py_TPFLAGS_NEWSTYLENUMBER to Py_TPFLAGS_CHECKTYPES.

- Use PyObject_RichCompareBool() in PySequence_Contains().

Objects/abstract.c

index 9050a4ce23fe954aea688f11a7dc3dd652c0c1bb..1189ae805dfd9d2fbf6d40fcbedf7a655796a77d 100644 (file)
@@ -6,7 +6,7 @@
 #include "structmember.h" /* we need the offsetof() macro from there */
 
 #define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \
-                               Py_TPFLAGS_NEWSTYLENUMBER)
+                               Py_TPFLAGS_CHECKTYPES)
 
 /* Shorthands to return certain errors */
 
@@ -1363,11 +1363,11 @@ PySequence_Contains(PyObject *w, PyObject *v) /* v in w */
                        }
                        return -1;
                }
-               cmp = PyObject_Compare(v, x);
+               cmp = PyObject_RichCompareBool(v, x, Py_EQ);
                Py_XDECREF(x);
-               if (cmp == 0)
+               if (cmp > 0)
                        return 1;
-               if (PyErr_Occurred())
+               if (cmp < 0)
                        return -1;
        }