| #ifndef Py_DICT_COMMON_H |
| #define Py_DICT_COMMON_H |
| |
| typedef struct { |
| /* Cached hash code of me_key. */ |
| Py_hash_t me_hash; |
| PyObject *me_key; |
| PyObject *me_value; /* This field is only meaningful for combined tables */ |
| } PyDictKeyEntry; |
| |
| /* dict_lookup_func() returns index of entry which can be used like DK_ENTRIES(dk)[index]. |
| * -1 when no entry found, -3 when compare raises error. |
| */ |
| typedef Py_ssize_t (*dict_lookup_func) |
| (PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr, |
| Py_ssize_t *hashpos); |
| |
| #define DKIX_EMPTY (-1) |
| #define DKIX_DUMMY (-2) /* Used internally */ |
| #define DKIX_ERROR (-3) |
| |
| /* See dictobject.c for actual layout of DictKeysObject */ |
| struct _dictkeysobject { |
| Py_ssize_t dk_refcnt; |
| Py_ssize_t dk_size; |
| dict_lookup_func dk_lookup; |
| Py_ssize_t dk_usable; |
| Py_ssize_t dk_nentries; /* How many entries are used. */ |
| char dk_indices[8]; /* dynamically sized. 8 is minimum. */ |
| }; |
| |
| #endif |