Skip to content

Commit 4ab3c27

Browse files
enable LOAD_ATTR_MODULE specialization even if getattr is defined
1 parent 4f9a8d0 commit 4ab3c27

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Python/specialize.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,8 @@ specialize_module_load_attr_lock_held(PyDictObject *dict, _Py_CODEUNIT *instr, P
365365
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_NON_STRING);
366366
return -1;
367367
}
368-
Py_ssize_t index = _PyDict_LookupIndex(dict, &_Py_ID(__getattr__));
368+
Py_ssize_t index = _PyDict_LookupIndex(dict, name);
369369
assert(index != DKIX_ERROR);
370-
if (index != DKIX_EMPTY) {
371-
SPECIALIZATION_FAIL(LOAD_ATTR, SPEC_FAIL_ATTR_MODULE_ATTR_NOT_FOUND);
372-
return -1;
373-
}
374-
index = _PyDict_LookupIndex(dict, name);
375-
assert (index != DKIX_ERROR);
376370
if (index != (uint16_t)index) {
377371
SPECIALIZATION_FAIL(LOAD_ATTR,
378372
index == DKIX_EMPTY ?

0 commit comments

Comments
 (0)