File indexing completed on 2025-01-18 10:06:50
0001
0002
0003 #ifndef Py_SETOBJECT_H
0004 #define Py_SETOBJECT_H
0005 #ifdef __cplusplus
0006 extern "C" {
0007 #endif
0008
0009 PyAPI_DATA(PyTypeObject) PySet_Type;
0010 PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
0011 PyAPI_DATA(PyTypeObject) PySetIter_Type;
0012
0013 PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
0014 PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);
0015
0016 PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key);
0017 PyAPI_FUNC(int) PySet_Clear(PyObject *set);
0018 PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key);
0019 PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
0020 PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
0021 PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
0022
0023 #define PyFrozenSet_CheckExact(ob) Py_IS_TYPE((ob), &PyFrozenSet_Type)
0024 #define PyFrozenSet_Check(ob) \
0025 (Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
0026 PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
0027
0028 #define PyAnySet_CheckExact(ob) \
0029 (Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type))
0030 #define PyAnySet_Check(ob) \
0031 (Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
0032 PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
0033 PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
0034
0035 #define PySet_CheckExact(op) Py_IS_TYPE(op, &PySet_Type)
0036 #define PySet_Check(ob) \
0037 (Py_IS_TYPE((ob), &PySet_Type) || \
0038 PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
0039
0040 #ifndef Py_LIMITED_API
0041 # define Py_CPYTHON_SETOBJECT_H
0042 # include "cpython/setobject.h"
0043 # undef Py_CPYTHON_SETOBJECT_H
0044 #endif
0045
0046 #ifdef __cplusplus
0047 }
0048 #endif
0049 #endif