gh-143469: enable LOAD_ATTR_MODULE specialization even if __getattr__ is defined (#143470)

This commit is contained in:
Kumar Aditya 2026-01-06 22:09:18 +05:30 committed by GitHub
parent 05406b221d
commit faa3dc7c64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 7 deletions

View file

@ -366,14 +366,8 @@ specialize_module_load_attr_lock_held(PyDictObject *dict, _Py_CODEUNIT *instr, P
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NON_STRING);
return -1;
}
Py_ssize_t index = _PyDict_LookupIndex(dict, &_Py_ID(__getattr__));
Py_ssize_t index = _PyDict_LookupIndex(dict, name);
assert(index != DKIX_ERROR);
if (index != DKIX_EMPTY) {
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_MODULE_ATTR_NOT_FOUND);
return -1;
}
index = _PyDict_LookupIndex(dict, name);
assert (index != DKIX_ERROR);
if (index != (uint16_t)index) {
SPECIALIZATION_FAIL(LOAD_ATTR,
index == DKIX_EMPTY ?