bpo-39573: PyXXX_Check() macros use Py_IS_TYPE() (GH-18508) · python/cpython@d212c3c (original) (raw)

Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ typedef struct {
19 19
20 20 PyAPI_DATA(PyTypeObject) PyMethod_Type;
21 21
22 -#define PyMethod_Check(op) (Py_TYPE(op)== &PyMethod_Type)
22 +#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type)
23 23
24 24 PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
25 25
@@ -40,7 +40,7 @@ typedef struct {
40 40
41 41 PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
42 42
43 -#define PyInstanceMethod_Check(op) (Py_TYPE(op) == &PyInstanceMethod_Type)
43 +#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type)
44 44
45 45 PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
46 46 PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);