mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Merge remote-tracking branch 'upstream/main' into lazy
This commit is contained in:
commit
db151a5192
869 changed files with 45727 additions and 16994 deletions
|
|
@ -400,8 +400,7 @@ static int _PyObject_InlineValuesConsistencyCheck(PyObject *obj);
|
|||
static inline Py_hash_t
|
||||
unicode_get_hash(PyObject *o)
|
||||
{
|
||||
assert(PyUnicode_CheckExact(o));
|
||||
return FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(o)->hash);
|
||||
return PyUnstable_Unicode_GET_CACHED_HASH(o);
|
||||
}
|
||||
|
||||
/* Print summary info about the state of the optimized allocator */
|
||||
|
|
@ -1915,10 +1914,14 @@ insertdict(PyInterpreterState *interp, PyDictObject *mp,
|
|||
if (old_value != value) {
|
||||
_PyDict_NotifyEvent(interp, PyDict_EVENT_MODIFIED, mp, key, value);
|
||||
assert(old_value != NULL);
|
||||
assert(!_PyDict_HasSplitTable(mp));
|
||||
if (DK_IS_UNICODE(mp->ma_keys)) {
|
||||
PyDictUnicodeEntry *ep = &DK_UNICODE_ENTRIES(mp->ma_keys)[ix];
|
||||
STORE_VALUE(ep, value);
|
||||
if (_PyDict_HasSplitTable(mp)) {
|
||||
STORE_SPLIT_VALUE(mp, ix, value);
|
||||
}
|
||||
else {
|
||||
PyDictUnicodeEntry *ep = &DK_UNICODE_ENTRIES(mp->ma_keys)[ix];
|
||||
STORE_VALUE(ep, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyDictKeyEntry *ep = &DK_ENTRIES(mp->ma_keys)[ix];
|
||||
|
|
@ -2528,18 +2531,6 @@ _PyDict_GetItemWithError(PyObject *dp, PyObject *kv)
|
|||
return _PyDict_GetItem_KnownHash(dp, kv, hash); // borrowed reference
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_PyDict_GetItemIdWithError(PyObject *dp, _Py_Identifier *key)
|
||||
{
|
||||
PyObject *kv;
|
||||
kv = _PyUnicode_FromId(key); /* borrowed */
|
||||
if (kv == NULL)
|
||||
return NULL;
|
||||
Py_hash_t hash = unicode_get_hash(kv);
|
||||
assert (hash != -1); /* interned strings have their hash value initialised */
|
||||
return _PyDict_GetItem_KnownHash(dp, kv, hash); // borrowed reference
|
||||
}
|
||||
|
||||
PyObject *
|
||||
_PyDict_GetItemStringWithError(PyObject *v, const char *key)
|
||||
{
|
||||
|
|
@ -4854,16 +4845,6 @@ _PyDict_Contains_KnownHash(PyObject *op, PyObject *key, Py_hash_t hash)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_PyDict_ContainsId(PyObject *op, _Py_Identifier *key)
|
||||
{
|
||||
PyObject *kv = _PyUnicode_FromId(key); /* borrowed */
|
||||
if (kv == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return PyDict_Contains(op, kv);
|
||||
}
|
||||
|
||||
/* Hack to implement "key in dict" */
|
||||
static PySequenceMethods dict_as_sequence = {
|
||||
0, /* sq_length */
|
||||
|
|
@ -5044,16 +5025,6 @@ PyDict_GetItemStringRef(PyObject *v, const char *key, PyObject **result)
|
|||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
_PyDict_SetItemId(PyObject *v, _Py_Identifier *key, PyObject *item)
|
||||
{
|
||||
PyObject *kv;
|
||||
kv = _PyUnicode_FromId(key); /* borrowed */
|
||||
if (kv == NULL)
|
||||
return -1;
|
||||
return PyDict_SetItem(v, kv, item);
|
||||
}
|
||||
|
||||
int
|
||||
PyDict_SetItemString(PyObject *v, const char *key, PyObject *item)
|
||||
{
|
||||
|
|
@ -5069,15 +5040,6 @@ PyDict_SetItemString(PyObject *v, const char *key, PyObject *item)
|
|||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
_PyDict_DelItemId(PyObject *v, _Py_Identifier *key)
|
||||
{
|
||||
PyObject *kv = _PyUnicode_FromId(key); /* borrowed */
|
||||
if (kv == NULL)
|
||||
return -1;
|
||||
return PyDict_DelItem(v, kv);
|
||||
}
|
||||
|
||||
int
|
||||
PyDict_DelItemString(PyObject *v, const char *key)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue