Skip to content

Commit 8d50e03

Browse files
[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 a353455) Co-authored-by: Sam Gross <[email protected]>
1 parent 5d35d27 commit 8d50e03

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
@@ -841,7 +841,10 @@ specialize_dict_access(
841841
return 0;
842842
}
843843
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
844-
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES && _PyObject_InlineValues(owner)->valid) {
844+
if (type->tp_flags & Py_TPFLAGS_INLINE_VALUES &&
845+
_PyObject_InlineValues(owner)->valid &&
846+
!(base_op == STORE_ATTR && _PyObject_GetManagedDict(owner) != NULL))
847+
{
845848
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
846849
assert(PyUnicode_CheckExact(name));
847850
Py_ssize_t index = _PyDictKeys_StringLookup(keys, name);

0 commit comments

Comments
 (0)