mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
Rich comparisons fall-out:
- Renamed Py_TPFLAGS_NEWSTYLENUMBER to Py_TPFLAGS_CHECKTYPES. - Use PyObject_RichCompareBool() in PySequence_Contains().
This commit is contained in:
parent
8998b4f691
commit
c31896960a
1 changed files with 4 additions and 4 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
#include "structmember.h" /* we need the offsetof() macro from there */
|
#include "structmember.h" /* we need the offsetof() macro from there */
|
||||||
|
|
||||||
#define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \
|
#define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \
|
||||||
Py_TPFLAGS_NEWSTYLENUMBER)
|
Py_TPFLAGS_CHECKTYPES)
|
||||||
|
|
||||||
/* Shorthands to return certain errors */
|
/* Shorthands to return certain errors */
|
||||||
|
|
||||||
|
|
@ -1363,11 +1363,11 @@ PySequence_Contains(PyObject *w, PyObject *v) /* v in w */
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cmp = PyObject_Compare(v, x);
|
cmp = PyObject_RichCompareBool(v, x, Py_EQ);
|
||||||
Py_XDECREF(x);
|
Py_XDECREF(x);
|
||||||
if (cmp == 0)
|
if (cmp > 0)
|
||||||
return 1;
|
return 1;
|
||||||
if (PyErr_Occurred())
|
if (cmp < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue