You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2021-07-24.22:45:30.358>created_at=<Date2021-07-23.00:51:19.896>labels= ['interpreter-core', 'type-feature']
title='Improve AttributeError on circular imports of submodules'updated_at=<Date2021-07-25.01:27:23.066>user='https://github.com/FFY00'
Python 3.9.6 (default, Jun 30 2021, 10:22:16)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import a.b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/anubis/test/a/b/__init__.py", line 1, in <module>
File "/home/anubis/test/a/b/c.py", line 3, in <module>
AttributeError: module 'a' has no attribute 'b'
This happens because even though the module a is initialized, the b attribute is not set due to the circular import. When a module is partially initialized, we get a more helpful error description hinting that we cannot access the attribute because the module is partially initialized, we could have something similar here.