mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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.
This commit is contained in:
parent
46496f9d12
commit
d439fb304c
6 changed files with 20 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue