gh-130373: Avoid locking in _LOAD_ATTR_WITH_HINT (#130372)

Avoid locking in _LOAD_ATTR_WITH_HINT
This commit is contained in:
Dino Viehland 2025-03-28 15:16:41 -07:00 committed by GitHub
parent 00f0771e4d
commit 2984ff9e51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 72 additions and 46 deletions

View file

@ -1009,6 +1009,9 @@ specialize_dict_access_hint(
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
_Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(dict);
#ifdef Py_GIL_DISABLED
_PyDict_EnsureSharedOnRead(dict);
#endif
// We found an instance with a __dict__.
if (_PyDict_HasSplitTable(dict)) {