PyDictObject

To ensure the lookup algorithm terminates, there must be at least one Unused slot (NULL key) in the table. The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL values == the number of Active items). To avoid slowing down lookups on a near-full table, we resize the table when it's two-thirds full.

*/ /// subclass of PyObjec

Members

Variables

ma_fill
Py_ssize_t ma_fill;

_

ma_lookup
PyDictEntry* function(PyDictObject* mp, PyObject* key, Py_hash_t hash) ma_lookup;

_

ma_mask
Py_ssize_t ma_mask;

The table contains ma_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.

ma_smalltable
PyDictEntry[PyDict_MINSIZE] ma_smalltable;

_

ma_table
PyDictEntry* ma_table;

ma_table points to ma_smalltable for small tables, else to additional malloc'ed memory. ma_table is never NULL! This rule saves repeated runtime null-tests in the workhorse getitem and setitem calls.

ma_used
Py_ssize_t ma_used;

_

Meta