Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/python3.8/dictobject.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 #ifndef Py_DICTOBJECT_H | |
2 #define Py_DICTOBJECT_H | |
3 #ifdef __cplusplus | |
4 extern "C" { | |
5 #endif | |
6 | |
7 /* Dictionary object type -- mapping from hashable object to object */ | |
8 | |
9 /* The distribution includes a separate file, Objects/dictnotes.txt, | |
10 describing explorations into dictionary design and optimization. | |
11 It covers typical dictionary use patterns, the parameters for | |
12 tuning dictionaries, and several ideas for possible optimizations. | |
13 */ | |
14 | |
15 PyAPI_DATA(PyTypeObject) PyDict_Type; | |
16 | |
17 #define PyDict_Check(op) \ | |
18 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) | |
19 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) | |
20 | |
21 PyAPI_FUNC(PyObject *) PyDict_New(void); | |
22 PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); | |
23 PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key); | |
24 PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); | |
25 PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); | |
26 PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); | |
27 PyAPI_FUNC(int) PyDict_Next( | |
28 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); | |
29 PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); | |
30 PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); | |
31 PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); | |
32 PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); | |
33 PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); | |
34 PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); | |
35 | |
36 /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ | |
37 PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); | |
38 | |
39 /* PyDict_Merge updates/merges from a mapping object (an object that | |
40 supports PyMapping_Keys() and PyObject_GetItem()). If override is true, | |
41 the last occurrence of a key wins, else the first. The Python | |
42 dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). | |
43 */ | |
44 PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, | |
45 PyObject *other, | |
46 int override); | |
47 | |
48 /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing | |
49 iterable objects of length 2. If override is true, the last occurrence | |
50 of a key wins, else the first. The Python dict constructor dict(seq2) | |
51 is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). | |
52 */ | |
53 PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, | |
54 PyObject *seq2, | |
55 int override); | |
56 | |
57 PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); | |
58 PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); | |
59 PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); | |
60 | |
61 /* Dictionary (keys, values, items) views */ | |
62 | |
63 PyAPI_DATA(PyTypeObject) PyDictKeys_Type; | |
64 PyAPI_DATA(PyTypeObject) PyDictValues_Type; | |
65 PyAPI_DATA(PyTypeObject) PyDictItems_Type; | |
66 | |
67 #define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type) | |
68 #define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type) | |
69 #define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type) | |
70 /* This excludes Values, since they are not sets. */ | |
71 # define PyDictViewSet_Check(op) \ | |
72 (PyDictKeys_Check(op) || PyDictItems_Check(op)) | |
73 | |
74 /* Dictionary (key, value, items) iterators */ | |
75 | |
76 PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; | |
77 PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; | |
78 PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; | |
79 | |
80 PyAPI_DATA(PyTypeObject) PyDictRevIterKey_Type; | |
81 PyAPI_DATA(PyTypeObject) PyDictRevIterItem_Type; | |
82 PyAPI_DATA(PyTypeObject) PyDictRevIterValue_Type; | |
83 | |
84 | |
85 #ifndef Py_LIMITED_API | |
86 # define Py_CPYTHON_DICTOBJECT_H | |
87 # include "cpython/dictobject.h" | |
88 # undef Py_CPYTHON_DICTOBJECT_H | |
89 #endif | |
90 | |
91 #ifdef __cplusplus | |
92 } | |
93 #endif | |
94 #endif /* !Py_DICTOBJECT_H */ |