annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/cpython/dictobject.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 #ifndef Py_CPYTHON_DICTOBJECT_H
jpayne@69 2 # error "this header file must not be included directly"
jpayne@69 3 #endif
jpayne@69 4
jpayne@69 5 #ifdef __cplusplus
jpayne@69 6 extern "C" {
jpayne@69 7 #endif
jpayne@69 8
jpayne@69 9 typedef struct _dictkeysobject PyDictKeysObject;
jpayne@69 10
jpayne@69 11 /* The ma_values pointer is NULL for a combined table
jpayne@69 12 * or points to an array of PyObject* for a split table
jpayne@69 13 */
jpayne@69 14 typedef struct {
jpayne@69 15 PyObject_HEAD
jpayne@69 16
jpayne@69 17 /* Number of items in the dictionary */
jpayne@69 18 Py_ssize_t ma_used;
jpayne@69 19
jpayne@69 20 /* Dictionary version: globally unique, value change each time
jpayne@69 21 the dictionary is modified */
jpayne@69 22 uint64_t ma_version_tag;
jpayne@69 23
jpayne@69 24 PyDictKeysObject *ma_keys;
jpayne@69 25
jpayne@69 26 /* If ma_values is NULL, the table is "combined": keys and values
jpayne@69 27 are stored in ma_keys.
jpayne@69 28
jpayne@69 29 If ma_values is not NULL, the table is splitted:
jpayne@69 30 keys are stored in ma_keys and values are stored in ma_values */
jpayne@69 31 PyObject **ma_values;
jpayne@69 32 } PyDictObject;
jpayne@69 33
jpayne@69 34 PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
jpayne@69 35 Py_hash_t hash);
jpayne@69 36 PyAPI_FUNC(PyObject *) _PyDict_GetItemIdWithError(PyObject *dp,
jpayne@69 37 struct _Py_Identifier *key);
jpayne@69 38 PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
jpayne@69 39 PyAPI_FUNC(PyObject *) PyDict_SetDefault(
jpayne@69 40 PyObject *mp, PyObject *key, PyObject *defaultobj);
jpayne@69 41 PyAPI_FUNC(int) _PyDict_SetItem_KnownHash(PyObject *mp, PyObject *key,
jpayne@69 42 PyObject *item, Py_hash_t hash);
jpayne@69 43 PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key,
jpayne@69 44 Py_hash_t hash);
jpayne@69 45 PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
jpayne@69 46 int (*predicate)(PyObject *value));
jpayne@69 47 PyDictKeysObject *_PyDict_NewKeysForClass(void);
jpayne@69 48 PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
jpayne@69 49 PyAPI_FUNC(int) _PyDict_Next(
jpayne@69 50 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
jpayne@69 51
jpayne@69 52 /* Get the number of items of a dictionary. */
jpayne@69 53 #define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used)
jpayne@69 54 PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash);
jpayne@69 55 PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
jpayne@69 56 PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
jpayne@69 57 PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
jpayne@69 58 Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
jpayne@69 59 PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *);
jpayne@69 60 PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *);
jpayne@69 61 PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *);
jpayne@69 62 PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
jpayne@69 63 #define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
jpayne@69 64
jpayne@69 65 PyAPI_FUNC(int) PyDict_ClearFreeList(void);
jpayne@69 66
jpayne@69 67 /* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0,
jpayne@69 68 the first occurrence of a key wins, if override is 1, the last occurrence
jpayne@69 69 of a key wins, if override is 2, a KeyError with conflicting key as
jpayne@69 70 argument is raised.
jpayne@69 71 */
jpayne@69 72 PyAPI_FUNC(int) _PyDict_MergeEx(PyObject *mp, PyObject *other, int override);
jpayne@69 73 PyAPI_FUNC(PyObject *) _PyDict_GetItemId(PyObject *dp, struct _Py_Identifier *key);
jpayne@69 74 PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyObject *item);
jpayne@69 75
jpayne@69 76 PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
jpayne@69 77 PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
jpayne@69 78
jpayne@69 79 int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
jpayne@69 80 PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
jpayne@69 81
jpayne@69 82 /* _PyDictView */
jpayne@69 83
jpayne@69 84 typedef struct {
jpayne@69 85 PyObject_HEAD
jpayne@69 86 PyDictObject *dv_dict;
jpayne@69 87 } _PyDictViewObject;
jpayne@69 88
jpayne@69 89 PyAPI_FUNC(PyObject *) _PyDictView_New(PyObject *, PyTypeObject *);
jpayne@69 90 PyAPI_FUNC(PyObject *) _PyDictView_Intersect(PyObject* self, PyObject *other);
jpayne@69 91
jpayne@69 92 #ifdef __cplusplus
jpayne@69 93 }
jpayne@69 94 #endif