summaryrefslogtreecommitdiffstats
path: root/Include/setobject.h
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-02-20 18:03:08 (GMT)
committerGitHub <noreply@github.com>2021-02-20 18:03:08 (GMT)
commitd439fb304ca3098aab1ed0a314996f9d29347b21 (patch)
tree10d231bac1b2f609a1179cbe8e6e06610080feb0 /Include/setobject.h
parent46496f9d12582bf11f4911ad0f23315d6f277907 (diff)
downloadcpython-d439fb304ca3098aab1ed0a314996f9d29347b21.zip
cpython-d439fb304ca3098aab1ed0a314996f9d29347b21.tar.gz
cpython-d439fb304ca3098aab1ed0a314996f9d29347b21.tar.bz2
bpo-43277: Add PySet_CheckExact to the C-API (GH-24598)
For some mysterious reason we have PySet_Check, PyFrozenSet_Check, PyAnySet_Check, PyAnySet_CheckExact and PyFrozenSet_CheckExact but no PySet_CheckExact.
Diffstat (limited to 'Include/setobject.h')
-rw-r--r--Include/setobject.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/Include/setobject.h b/Include/setobject.h
index 119619e..62516be 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -88,18 +88,21 @@ PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
#define PyFrozenSet_CheckExact(ob) Py_IS_TYPE(ob, &PyFrozenSet_Type)
+#define PyFrozenSet_Check(ob) \
+ (Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
+ PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
+
#define PyAnySet_CheckExact(ob) \
(Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type))
#define PyAnySet_Check(ob) \
(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_CheckExact(op) Py_IS_TYPE(op, &PySet_Type)
#define PySet_Check(ob) \
(Py_IS_TYPE(ob, &PySet_Type) || \
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
-#define PyFrozenSet_Check(ob) \
- (Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
- PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
#ifdef __cplusplus
}