Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:49

0001 #ifndef Py_DICTOBJECT_H
0002 #define Py_DICTOBJECT_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006 
0007 /* Dictionary object type -- mapping from hashable object to object */
0008 
0009 /* The distribution includes a separate file, Objects/dictnotes.txt,
0010    describing explorations into dictionary design and optimization.
0011    It covers typical dictionary use patterns, the parameters for
0012    tuning dictionaries, and several ideas for possible optimizations.
0013 */
0014 
0015 PyAPI_DATA(PyTypeObject) PyDict_Type;
0016 
0017 #define PyDict_Check(op) \
0018                  PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
0019 #define PyDict_CheckExact(op) Py_IS_TYPE((op), &PyDict_Type)
0020 
0021 PyAPI_FUNC(PyObject *) PyDict_New(void);
0022 PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
0023 PyAPI_FUNC(PyObject *) PyDict_GetItemWithError(PyObject *mp, PyObject *key);
0024 PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
0025 PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
0026 PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
0027 PyAPI_FUNC(int) PyDict_Next(
0028     PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
0029 PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
0030 PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
0031 PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
0032 PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
0033 PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
0034 PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
0035 
0036 /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */
0037 PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other);
0038 
0039 /* PyDict_Merge updates/merges from a mapping object (an object that
0040    supports PyMapping_Keys() and PyObject_GetItem()).  If override is true,
0041    the last occurrence of a key wins, else the first.  The Python
0042    dict.update(other) is equivalent to PyDict_Merge(dict, other, 1).
0043 */
0044 PyAPI_FUNC(int) PyDict_Merge(PyObject *mp,
0045                              PyObject *other,
0046                              int override);
0047 
0048 /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing
0049    iterable objects of length 2.  If override is true, the last occurrence
0050    of a key wins, else the first.  The Python dict constructor dict(seq2)
0051    is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1).
0052 */
0053 PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
0054                                      PyObject *seq2,
0055                                      int override);
0056 
0057 PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
0058 PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
0059 PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
0060 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
0061 PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
0062 #endif
0063 
0064 /* Dictionary (keys, values, items) views */
0065 
0066 PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
0067 PyAPI_DATA(PyTypeObject) PyDictValues_Type;
0068 PyAPI_DATA(PyTypeObject) PyDictItems_Type;
0069 
0070 #define PyDictKeys_Check(op) PyObject_TypeCheck((op), &PyDictKeys_Type)
0071 #define PyDictValues_Check(op) PyObject_TypeCheck((op), &PyDictValues_Type)
0072 #define PyDictItems_Check(op) PyObject_TypeCheck((op), &PyDictItems_Type)
0073 /* This excludes Values, since they are not sets. */
0074 # define PyDictViewSet_Check(op) \
0075     (PyDictKeys_Check(op) || PyDictItems_Check(op))
0076 
0077 /* Dictionary (key, value, items) iterators */
0078 
0079 PyAPI_DATA(PyTypeObject) PyDictIterKey_Type;
0080 PyAPI_DATA(PyTypeObject) PyDictIterValue_Type;
0081 PyAPI_DATA(PyTypeObject) PyDictIterItem_Type;
0082 
0083 PyAPI_DATA(PyTypeObject) PyDictRevIterKey_Type;
0084 PyAPI_DATA(PyTypeObject) PyDictRevIterItem_Type;
0085 PyAPI_DATA(PyTypeObject) PyDictRevIterValue_Type;
0086 
0087 
0088 #ifndef Py_LIMITED_API
0089 #  define Py_CPYTHON_DICTOBJECT_H
0090 #  include "cpython/dictobject.h"
0091 #  undef Py_CPYTHON_DICTOBJECT_H
0092 #endif
0093 
0094 #ifdef __cplusplus
0095 }
0096 #endif
0097 #endif /* !Py_DICTOBJECT_H */