diff options
author | Raymond Hettinger <python@rcn.com> | 2005-08-07 13:02:53 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-08-07 13:02:53 (GMT) |
commit | bc841a1464b53ddbaa989e4cae97024fbe111abf (patch) | |
tree | 426c7eaff8772527ca64cb47f64bd71de938fd3b /Include | |
parent | e9fe7e0ef33f2a0c8da7079f3e6878c88975a8a1 (diff) | |
download | cpython-bc841a1464b53ddbaa989e4cae97024fbe111abf.zip cpython-bc841a1464b53ddbaa989e4cae97024fbe111abf.tar.gz cpython-bc841a1464b53ddbaa989e4cae97024fbe111abf.tar.bz2 |
* Bring in INIT_NONZERO_SET_SLOTS macro from dictionary code.
* Bring in free list from dictionary code.
* Improve several comments.
* Differencing can leave many dummy entries. If more than
1/6 are dummies, then resize them away.
* Factor-out common code with new macro, PyAnySet_CheckExact.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/setobject.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Include/setobject.h b/Include/setobject.h index f720a82..6a829f0 100644 --- a/Include/setobject.h +++ b/Include/setobject.h @@ -59,12 +59,16 @@ struct _setobject { PyAPI_DATA(PyTypeObject) PySet_Type; PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; -/* Invariants for frozensets only: +/* Invariants for frozensets: * data is immutable. * hash is the hash of the frozenset or -1 if not computed yet. + * Invariants for sets: + * hash is -1 */ #define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) +#define PyAnySet_CheckExact(ob) \ + ((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type) #define PyAnySet_Check(ob) \ ((ob)->ob_type == &PySet_Type || (ob)->ob_type == &PyFrozenSet_Type || \ PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ |