blob: abbd8477ad83bcd277c8f9f6627520c0e88d6d45 [file] [log] [blame]
Raymond Hettingera690a992003-11-16 16:17:49 +00001
2/* Set object interface */
3
4#ifndef Py_SETOBJECT_H
5#define Py_SETOBJECT_H
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10/*
11This data structure is shared by set and frozenset objects.
12*/
13
14typedef struct {
15 PyObject_HEAD
16 PyObject *data;
17 long hash; /* only used by frozenset objects */
Raymond Hettinger691d8052004-05-30 07:26:47 +000018 PyObject *weakreflist; /* List of weak references */
Raymond Hettingera690a992003-11-16 16:17:49 +000019} PySetObject;
20
21PyAPI_DATA(PyTypeObject) PySet_Type;
22PyAPI_DATA(PyTypeObject) PyFrozenSet_Type;
23
Raymond Hettingerf5f41bf2003-11-24 02:57:33 +000024#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)
Raymond Hettinger50a4bb32003-11-17 16:42:33 +000025#define PyAnySet_Check(ob) \
26 ((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \
27 PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
28 PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))
29
Raymond Hettingera690a992003-11-16 16:17:49 +000030#ifdef __cplusplus
31}
32#endif
33#endif /* !Py_SETOBJECT_H */