-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Prefer using __spec__ over module_repr() for ModuleType.__repr__ #86303
Comments
Once all traces of module_repr() are gone, raise an Once this is implemented and has been out in the wild for a sufficient amount of time, it should be switching to a DeprecationWarning and then the fallback eventually removed. |
Should try to use __spec__ first, but if it isn't set then fall back on module_repr() and raise an ImportWarning. See Lib/importlib/_bootstrap.py:_module_repr. |
Thinking about it more, raising ImportWarning (or DeprecationWarning) is unnecessarily noisy as the existence of the module isn't problematic, it just won't be used anymore in the future. So updating the code to use __spec__ first and then document in "What's New" should be good enough. |
Meant to say, "existence of the _method_ isn't problematic". |
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: