PySetObject

This data structure is shared by set and frozenset objects.

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

subclass of PyObject.

Members

Variables

data
PyObject* data;

Availability: 2.4

fill
Py_ssize_t fill;

Availability: >= 2.5

hash
Py_hash_t hash;

only used by frozenset objects

lookup
setentry* function(PySetObject* so, PyObject* key, Py_hash_t hash) lookup;

_

mask
Py_ssize_t mask;

The table contains mask + 1 slots, and that's a power of 2. We store the mask instead of the size because the mask is more frequently needed.

smalltable
setentry[PySet_MINSIZE] smalltable;

_

table
setentry* table;

table points to smalltable for small tables, else to additional malloc'ed memory. table is never NULL! This rule saves repeated runtime null-tests.

used
Py_ssize_t used;

Availability: >= 2.5

weakreflist
PyObject* weakreflist;

List of weak references

Meta