diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-12-06 16:14:26 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-06 16:14:26 (GMT) |
| commit | 8d50e0320bdcf88ccfdd57a54fa581a57c04e95c (patch) | |
| tree | c164a47729dbf84fee6866f53b673038741e6346 /Python | |
| parent | 5d35d279a5150fd5ea4731c53fc3459cf22f1d16 (diff) | |
| download | cpython-8d50e0320bdcf88ccfdd57a54fa581a57c04e95c.zip cpython-8d50e0320bdcf88ccfdd57a54fa581a57c04e95c.tar.gz cpython-8d50e0320bdcf88ccfdd57a54fa581a57c04e95c.tar.bz2 | |
[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 a353455fca1b8f468ff3ffbb4b5e316510b4fd43)
Co-authored-by: Sam Gross <colesbury@gmail.com>
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 1a2043d..ad166ea 100644 --- a/Python/specialize.c +++ b/Python/specialize.c @@ -841,7 +841,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); |
