]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39573: PyXXX_Check() macros use Py_IS_TYPE() (GH-18508)
authorDong-hee Na <donghee.na92@gmail.com>
Fri, 14 Feb 2020 07:48:12 +0000 (16:48 +0900)
committerGitHub <noreply@github.com>
Fri, 14 Feb 2020 07:48:12 +0000 (08:48 +0100)
Update PyXXX_Check() macros in Include/ to use
the new Py_IS_TYPE function.

Include/classobject.h
Include/picklebufobject.h

index 8742720720550c2d15e17f1627a626160229836d..1952f673b7d865442a85487f70c36fbab58f7102 100644 (file)
@@ -19,7 +19,7 @@ typedef struct {
 
 PyAPI_DATA(PyTypeObject) PyMethod_Type;
 
-#define PyMethod_Check(op) (Py_TYPE(op)== &PyMethod_Type)
+#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type)
 
 PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
 
@@ -40,7 +40,7 @@ typedef struct {
 
 PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
 
-#define PyInstanceMethod_Check(op) (Py_TYPE(op) == &PyInstanceMethod_Type)
+#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type)
 
 PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
 PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);
index f07e900bf26dacf2dfcc797495b245fa03df50be..0df2561dceaea04a9942b2aae18762dfc2fe806d 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
 
 PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type;
 
-#define PyPickleBuffer_Check(op) (Py_TYPE(op) == &PyPickleBuffer_Type)
+#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type)
 
 /* Create a PickleBuffer redirecting to the given buffer-enabled object */
 PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *);