mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
e59334ebc9
commit
557287075c
10 changed files with 15 additions and 17 deletions
|
@ -657,7 +657,7 @@ do_richcompare(PyThreadState *tstate, PyObject *v, PyObject *w, int op)
|
|||
PyObject *res;
|
||||
int checked_reverse_op = 0;
|
||||
|
||||
if (Py_TYPE(v) != Py_TYPE(w) &&
|
||||
if (!Py_IS_TYPE(v, Py_TYPE(w)) &&
|
||||
PyType_IsSubtype(Py_TYPE(w), Py_TYPE(v)) &&
|
||||
(f = Py_TYPE(w)->tp_richcompare) != NULL) {
|
||||
checked_reverse_op = 1;
|
||||
|
@ -1907,7 +1907,7 @@ _Py_GetObjects(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
for (i = 0; (n == 0 || i < n) && op != &refchain; i++) {
|
||||
while (op == self || op == args || op == res || op == t ||
|
||||
(t != NULL && Py_TYPE(op) != (PyTypeObject *) t)) {
|
||||
(t != NULL && !Py_IS_TYPE(op, (PyTypeObject *) t))) {
|
||||
op = op->_ob_next;
|
||||
if (op == &refchain)
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue