diff options
author | Sam Gross <colesbury@gmail.com> | 2024-12-06 15:48:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-06 15:48:24 (GMT) |
commit | a353455fca1b8f468ff3ffbb4b5e316510b4fd43 (patch) | |
tree | 0b22cefa6b9ea0744dbe8ab7e940faddeda51a09 /Python | |
parent | 36c6178d372b075e9c74b786cfb5e47702976b1c (diff) | |
download | cpython-a353455fca1b8f468ff3ffbb4b5e316510b4fd43.zip cpython-a353455fca1b8f468ff3ffbb4b5e316510b4fd43.tar.gz cpython-a353455fca1b8f468ff3ffbb4b5e316510b4fd43.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/specialize.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/specialize.c b/Python/specialize.c index ec2cd70..d3fea71 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -947,7 +947,10 @@ specialize_dict_access( return 0; } _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; assert(PyUnicode_CheckExact(name)); Py_ssize_t index = _PyDictKeys_StringLookup(keys, name); |