8000 gh-125610: Fix `STORE_ATTR_INSTANCE_VALUE` specialization check (GH-1… · python/cpython@a353455 · GitHub
[go: up one dir, main page]

Skip to content

Commit a353455

Browse files
authored
gh-125610: Fix STORE_ATTR_INSTANCE_VALUE specialization check (GH-125612)
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.
1 parent 36c6178 commit a353455

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/specialize.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,10 @@ specialize_dict_access(
947947
return 0;
948948
}
949949
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
950-
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES && _PyObject_InlineValues(owner)->valid) {
950+
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES &&
951+
_PyObject_InlineValues(owner)->valid &&
952+
!(base_op == STORE_ATTR && _PyObject_GetManagedDict(owner) != NULL))
953+
{
951954
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
952955
assert(PyUnicode_CheckExact(name));
953956
Py_ssize_t index = _PyDictKeys_StringLookup(keys, name);

0 commit comments

Comments
 (0)
0