34
34
typedef struct _setobject PySetObject;
35
35
struct _setobject {
38
Py_ssize_t fill; /* # Active + # Dummy */
39
Py_ssize_t used; /* # Active */
41
/* The table contains mask + 1 slots, and that's a power of 2.
42
* We store the mask instead of the size because the mask is more
47
/* table points to smalltable for small tables, else to
48
* additional malloc'ed memory. table is never NULL! This rule
49
* saves repeated runtime null-tests.
52
setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
53
setentry smalltable[PySet_MINSIZE];
55
long hash; /* only used by frozenset objects */
56
PyObject *weakreflist; /* List of weak references */
38
Py_ssize_t fill; /* # Active + # Dummy */
39
Py_ssize_t used; /* # Active */
41
/* The table contains mask + 1 slots, and that's a power of 2.
42
* We store the mask instead of the size because the mask is more
47
/* table points to smalltable for small tables, else to
48
* additional malloc'ed memory. table is never NULL! This rule
49
* saves repeated runtime null-tests.
52
setentry *(*lookup)(PySetObject *so, PyObject *key, long hash);
53
setentry smalltable[PySet_MINSIZE];
55
long hash; /* only used by frozenset objects */
56
PyObject *weakreflist; /* List of weak references */
59
59
PyAPI_DATA(PyTypeObject) PySet_Type;
70
70
#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type)
71
71
#define PyAnySet_CheckExact(ob) \
72
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
72
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type)
73
73
#define PyAnySet_Check(ob) \
74
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
75
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
76
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
74
(Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \
75
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
76
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
77
77
#define PySet_Check(ob) \
78
(Py_TYPE(ob) == &PySet_Type || \
79
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
78
(Py_TYPE(ob) == &PySet_Type || \
79
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
80
80
#define PyFrozenSet_Check(ob) \
81
(Py_TYPE(ob) == &PyFrozenSet_Type || \
82
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
81
(Py_TYPE(ob) == &PyFrozenSet_Type || \
82
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
84
84
PyAPI_FUNC(PyObject *) PySet_New(PyObject *);
85
85
PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *);