mirror of
https://github.com/python/cpython.git
synced 2025-08-26 03:34:43 +00:00
[3.13] gh-125610: Fix STORE_ATTR_INSTANCE_VALUE
specialization check (GH-125612) (GH-127698)
The `STORE_ATTR_INSTANCE_VALUE` opcode doesn't support objects with
non-NULL managed dictionaries, so don't specialize to that op in that case.
(cherry picked from commit a353455fca
)
Co-authored-by: Sam Gross <colesbury@gmail.com>
This commit is contained in:
parent
5d35d279a5
commit
8d50e0320b
1 changed files with 4 additions and 1 deletions
|
@ -841,7 +841,10 @@ specialize_dict_access(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
|
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
|
||||||
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES && _PyObject_InlineValues(owner)->valid) {
|
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES &&
|
||||||
|
_PyObject_InlineValues(owner)->valid &&
|
||||||
|
!(base_op == STORE_ATTR && _PyObject_GetManagedDict(owner) != NULL))
|
||||||
|
{
|
||||||
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
|
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
|
||||||
assert(PyUnicode_CheckExact(name));
|
assert(PyUnicode_CheckExact(name));
|
||||||
Py_ssize_t index = _PyDictKeys_StringLookup(keys, name);
|
Py_ssize_t index = _PyDictKeys_StringLookup(keys, name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue