diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2020-02-13 17:37:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-13 17:37:17 (GMT) |
commit | d905df766c367c350f20c46ccd99d4da19ed57d8 (patch) | |
tree | 9e08a6c88d6b0dd4e73810c3f3a152b61bd773aa /Include/setobject.h | |
parent | 968dcd9e7a4d3aa9aaa1dfca693adf60d6b71ce7 (diff) | |
download | cpython-d905df766c367c350f20c46ccd99d4da19ed57d8.zip cpython-d905df766c367c350f20c46ccd99d4da19ed57d8.tar.gz cpython-d905df766c367c350f20c46ccd99d4da19ed57d8.tar.bz2 |
bpo-39573: Add Py_IS_TYPE() function (GH-18488)
Co-Author: Neil Schemenauer <nas-github@arctrix.com>
Diffstat (limited to 'Include/setobject.h')
-rw-r--r-- | Include/setobject.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Include/setobject.h b/Include/setobject.h index fc0ea83..05a097e 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -88,18 +88,18 @@ PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); -#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) +#define PyFrozenSet_CheckExact(ob) Py_IS_TYPE(ob, &PyFrozenSet_Type) #define PyAnySet_CheckExact(ob) \ - (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) + (Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type)) #define PyAnySet_Check(ob) \ - (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ + (Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #define PySet_Check(ob) \ - (Py_TYPE(ob) == &PySet_Type || \ + (Py_IS_TYPE(ob, &PySet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) #define PyFrozenSet_Check(ob) \ - (Py_TYPE(ob) == &PyFrozenSet_Type || \ + (Py_IS_TYPE(ob, &PyFrozenSet_Type) || \ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) #ifdef __cplusplus |