2003-11-16 16:17:49 +00:00
|
|
|
|
|
|
|
/* Set object interface */
|
|
|
|
|
|
|
|
#ifndef Py_SETOBJECT_H
|
|
|
|
#define Py_SETOBJECT_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
This data structure is shared by set and frozenset objects.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
PyObject_HEAD
|
|
|
|
PyObject *data;
|
|
|
|
long hash; /* only used by frozenset objects */
|
2004-05-30 07:26:47 +00:00
|
|
|
PyObject *weakreflist; /* List of weak references */
|
2004-10-28 16:32:00 +00:00
|
|
|
|
|
|
|
/* Invariants:
|
|
|
|
* data is a dictionary whose values are all True.
|
|
|
|
* data points to the same dict for the whole life of the set.
|
|
|
|
* For frozensets only:
|
|
|
|
* data is immutable.
|
|
|
|
* hash is the hash of the frozenset or -1 if not computed yet.
|
|
|
|
*/
|
2003-11-16 16:17:49 +00:00
|
|
|
} PySetObject;
|
|
|
|
|
|
|
|
PyAPI_DATA(PyTypeObject) PySet_Type;
|
|
|
|
PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
|
|
|
|
|
2003-11-24 02:57:33 +00:00
|
|
|
#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
|
2003-11-17 16:42:33 +00:00
|
|
|
#define PyAnySet_Check(ob) \
|
|
|
|
((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
|
|
|
|
PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
|
|
|
|
PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
|
|
|
|
|
2003-11-16 16:17:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_SETOBJECT_H */
|