mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +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
|
@ -1889,7 +1889,7 @@ mro_invoke(PyTypeObject *type)
|
|||
{
|
||||
PyObject *mro_result;
|
||||
PyObject *new_mro;
|
||||
int custom = (Py_TYPE(type) != &PyType_Type);
|
||||
const int custom = !Py_IS_TYPE(type, &PyType_Type);
|
||||
|
||||
if (custom) {
|
||||
int unbound;
|
||||
|
@ -6191,7 +6191,7 @@ FUNCNAME(PyObject *self, PyObject *other) \
|
|||
PyThreadState *tstate = _PyThreadState_GET(); \
|
||||
_Py_static_string(op_id, OPSTR); \
|
||||
_Py_static_string(rop_id, ROPSTR); \
|
||||
int do_other = Py_TYPE(self) != Py_TYPE(other) && \
|
||||
int do_other = !Py_IS_TYPE(self, Py_TYPE(other)) && \
|
||||
Py_TYPE(other)->tp_as_number != NULL && \
|
||||
Py_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \
|
||||
if (Py_TYPE(self)->tp_as_number != NULL && \
|
||||
|
@ -7901,7 +7901,7 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type)
|
|||
Py_INCREF(self);
|
||||
return self;
|
||||
}
|
||||
if (Py_TYPE(su) != &PySuper_Type)
|
||||
if (!Py_IS_TYPE(su, &PySuper_Type))
|
||||
/* If su is an instance of a (strict) subclass of super,
|
||||
call its type */
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(su),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue