Changeset 388 for python/vendor/current/Include/dictobject.h
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Include/dictobject.h
r2 r388 49 49 50 50 typedef struct { 51 52 53 54 55 56 57 51 /* Cached hash code of me_key. Note that hash codes are C longs. 52 * We have to use Py_ssize_t instead because dict_popitem() abuses 53 * me_hash to hold a search finger. 54 */ 55 Py_ssize_t me_hash; 56 PyObject *me_key; 57 PyObject *me_value; 58 58 } PyDictEntry; 59 59 … … 69 69 typedef struct _dictobject PyDictObject; 70 70 struct _dictobject { 71 72 73 71 PyObject_HEAD 72 Py_ssize_t ma_fill; /* # Active + # Dummy */ 73 Py_ssize_t ma_used; /* # Active */ 74 74 75 76 77 78 79 75 /* The table contains ma_mask + 1 slots, and that's a power of 2. 76 * We store the mask instead of the size because the mask is more 77 * frequently needed. 78 */ 79 Py_ssize_t ma_mask; 80 80 81 82 83 84 85 86 87 88 81 /* ma_table points to ma_smalltable for small tables, else to 82 * additional malloc'ed memory. ma_table is never NULL! This rule 83 * saves repeated runtime null-tests in the workhorse getitem and 84 * setitem calls. 85 */ 86 PyDictEntry *ma_table; 87 PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); 88 PyDictEntry ma_smalltable[PyDict_MINSIZE]; 89 89 }; 90 90 91 91 PyAPI_DATA(PyTypeObject) PyDict_Type; 92 PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; 93 PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; 94 PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; 95 PyAPI_DATA(PyTypeObject) PyDictKeys_Type; 96 PyAPI_DATA(PyTypeObject) PyDictItems_Type; 97 PyAPI_DATA(PyTypeObject) PyDictValues_Type; 92 98 93 99 #define PyDict_Check(op) \ 94 100 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) 95 101 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) 102 #define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) 103 #define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) 104 #define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) 105 /* This excludes Values, since they are not sets. */ 106 # define PyDictViewSet_Check(op) \ 107 (PyDictKeys_Check(op) || PyDictItems_Check(op)) 96 108 97 109 PyAPI_FUNC(PyObject *) PyDict_New(void); … … 101 113 PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); 102 114 PyAPI_FUNC(int) PyDict_Next( 103 115 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); 104 116 PyAPI_FUNC(int) _PyDict_Next( 105 117 PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); 106 118 PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); 107 119 PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); … … 112 124 PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); 113 125 PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); 126 PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); 114 127 115 128 /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ … … 122 135 */ 123 136 PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, 124 125 137 PyObject *other, 138 int override); 126 139 127 140 /* PyDict_MergeFromSeq2 updates/merges from an iterable object producing … … 131 144 */ 132 145 PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, 133 134 146 PyObject *seq2, 147 int override); 135 148 136 149 PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
Note:
See TracChangeset
for help on using the changeset viewer.