aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-02-14 02:37:17 +0900
committerGitHub <noreply@github.com>2020-02-13 18:37:17 +0100
commitd905df766c367c350f20c46ccd99d4da19ed57d8 (patch)
tree9e08a6c88d6b0dd4e73810c3f3a152b61bd773aa /Include/genobject.h
parentbpo-39573: Fix bad copy-paste in Py_SET_SIZE (GH-18496) (diff)
downloadcpython-d905df766c367c350f20c46ccd99d4da19ed57d8.tar.gz
cpython-d905df766c367c350f20c46ccd99d4da19ed57d8.tar.bz2
cpython-d905df766c367c350f20c46ccd99d4da19ed57d8.zip
bpo-39573: Add Py_IS_TYPE() function (GH-18488)
Co-Author: Neil Schemenauer <nas-github@arctrix.com>
Diffstat (limited to 'Include/genobject.h')
-rw-r--r--Include/genobject.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Include/genobject.h b/Include/genobject.h
index 5ee9a2831d1..b87a6485631 100644
--- a/Include/genobject.h
+++ b/Include/genobject.h
@@ -38,7 +38,7 @@ typedef struct {
PyAPI_DATA(PyTypeObject) PyGen_Type;
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
-#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
+#define PyGen_CheckExact(op) Py_IS_TYPE(op, &PyGen_Type)
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
@@ -58,7 +58,7 @@ typedef struct {
PyAPI_DATA(PyTypeObject) PyCoro_Type;
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
-#define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type)
+#define PyCoro_CheckExact(op) Py_IS_TYPE(op, &PyCoro_Type)
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *,
PyObject *name, PyObject *qualname);
@@ -89,7 +89,7 @@ PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *,
PyObject *name, PyObject *qualname);
-#define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type)
+#define PyAsyncGen_CheckExact(op) Py_IS_TYPE(op, &PyAsyncGen_Type)
PyObject *_PyAsyncGenValueWrapperNew(PyObject *);