-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show clear error message on circular import #64689
Comments
If there's a circular import in my program, I don't want to see an error message, "Cannot import name 'foo'" and then say in my mind, "ah, I'm an experienced Python developer, I know that when Python says that it often means that there's a circular import problem." I want the error message to **say there's a circular import problem**, so (a) I won't have to remember this piece of trivia and (b) less experienced developers won't have to bang their heads on their desks trying to figure out why the import isn't working. Bonus points if the error message actually shows which module is trying to import a module that imports itself, so we'll know where to fix. |
It's not as simple as it sounds because failures from "from ... import ..." are triggered in the eval loop and not in import and without thinking it through I don't know if you could use the fine-grained import locks to inspect if something is in the middle of being imported or not that way. |
Thanks for the patch, Anthony! |
This PR introduced a reference leak tracked in: |
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
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: