Skip to content

Commit d212c3c

Browse files
authored
bpo-39573: PyXXX_Check() macros use Py_IS_TYPE() (GH-18508)
Update PyXXX_Check() macros in Include/ to use the new Py_IS_TYPE function.
1 parent 7386a70 commit d212c3c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Include/classobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919

2020
PyAPI_DATA(PyTypeObject) PyMethod_Type;
2121

22-
#define PyMethod_Check(op) (Py_TYPE(op)== &PyMethod_Type)
22+
#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type)
2323

2424
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
2525

@@ -40,7 +40,7 @@ typedef struct {
4040

4141
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
4242

43-
#define PyInstanceMethod_Check(op) (Py_TYPE(op) == &PyInstanceMethod_Type)
43+
#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type)
4444

4545
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
4646
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);

Include/picklebufobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212

1313
PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type;
1414

15-
#define PyPickleBuffer_Check(op) (Py_TYPE(op) == &PyPickleBuffer_Type)
15+
#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type)
1616

1717
/* Create a PickleBuffer redirecting to the given buffer-enabled object */
1818
PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *);

0 commit comments

Comments
 (0)