Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | #ifndef Py_SETOBJECT_H |
2 | #define Py_SETOBJECT_H | |
3 | #ifdef __cplusplus | |
4 | extern "C" { | |
5 | #endif | |
6 | ||
7 | /* | |
8 | This data structure is shared by set and frozenset objects. | |
9 | */ | |
10 | ||
11 | typedef struct { | |
12 | PyObject_HEAD | |
13 | PyObject *data; | |
14 | long hash; /* only used by frozenset objects */ | |
15 | PyObject *weakreflist; /* List of weak references */ | |
16 | ||
17 | /* Invariants: | |
18 | * data is a dictionary whose values are all True. | |
19 | * data points to the same dict for the whole life of the set. | |
20 | * For frozensets only: | |
21 | * data is immutable. | |
22 | * hash is the hash of the frozenset or -1 if not computed yet. | |
23 | */ | |
24 | } PySetObject; | |
25 | ||
26 | PyAPI_DATA(PyTypeObject) PySet_Type; | |
27 | PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; | |
28 | ||
29 | #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) | |
30 | #define PyAnySet_Check(ob) \ | |
31 | ((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \ | |
32 | PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ | |
33 | PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) | |
34 | ||
35 | #ifdef __cplusplus | |
36 | } | |
37 | #endif | |
38 | #endif /* !Py_SETOBJECT_H */ |