@@ -24,14 +24,24 @@ typedef struct {
2424 /* Cached hash code of me_key. */
2525 Py_hash_t me_hash ;
2626 PyObject * me_key ;
27- PyObject * me_value ; /* This field is only meaningful for combined tables */
27+ PyObject * _me_value ; /* This field is only meaningful for combined tables */
2828} PyDictKeyEntry ;
2929
3030typedef struct {
3131 PyObject * me_key ; /* The key must be Unicode and have hash. */
32- PyObject * me_value ; /* This field is only meaningful for combined tables */
32+ PyObject * _me_value ; /* This field is only meaningful for combined tables */
3333} PyDictUnicodeEntry ;
3434
35+ #define _PyDictEntry_IsImmutable (entry ) (((uintptr_t)((entry)->_me_value)) & 0x1)
36+ #define _PyDictEntry_SetImmutable (entry ) ((entry)->_me_value = (PyObject*)((uintptr_t)(entry)->_me_value | 0x1))
37+ #define _PyDictEntry_Hash (entry ) ((entry)->me_hash)
38+ #define _PyDictEntry_Key (entry ) ((entry)->me_key)
39+ #define _PyDictEntry_Value (entry ) ((PyObject*)((((uintptr_t)((entry)->_me_value)) >> 1) << 1))
40+ #define _PyDictEntry_SetValue (entry , value ) ((entry)->_me_value = value)
41+ #define _PyDictEntry_IsEmpty (entry ) ((entry)->_me_value == NULL)
42+
43+ extern PyObject * _PyDict_IsKeyImmutable (PyObject * op , PyObject * key );
44+
3545extern PyDictKeysObject * _PyDict_NewKeysForClass (void );
3646extern PyObject * _PyDict_FromKeys (PyObject * , PyObject * , PyObject * );
3747
@@ -50,6 +60,7 @@ extern Py_ssize_t _Py_dict_lookup(PyDictObject *mp, PyObject *key, Py_hash_t has
5060extern Py_ssize_t _PyDict_LookupIndex (PyDictObject * , PyObject * );
5161extern Py_ssize_t _PyDictKeys_StringLookup (PyDictKeysObject * dictkeys , PyObject * key );
5262extern PyObject * _PyDict_LoadGlobal (PyDictObject * , PyDictObject * , PyObject * );
63+ extern PyObject * _PyDict_SetKeyImmutable (PyDictObject * mp , PyObject * key );
5364
5465/* Consumes references to key and value */
5566extern int _PyDict_SetItem_Take2 (PyDictObject * op , PyObject * key , PyObject * value );
0 commit comments