This came up in numpy/numpy#30494
Currently the LOAD_ATTR specialization for modules does not happen when the module defines __getattr__. However as per https://peps.python.org/pep-0562/#specification, __getattr__ is executed only when the attribute is not present in module's dict so we can still specialize if the attribute is present in module's dict.
Linked PRs
This came up in numpy/numpy#30494
Currently the LOAD_ATTR specialization for modules does not happen when the module defines
__getattr__. However as per https://peps.python.org/pep-0562/#specification,__getattr__is executed only when the attribute is not present in module's dict so we can still specialize if the attribute is present in module's dict.Linked PRs
__getattr__is defined #143470