-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-122255: Synchronize warnings in C and Python implementations of the warnings module #122824
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
base: main
Are you sure you want to change the base?
gh-122255: Synchronize warnings in C and Python implementations of the warnings module #122824
Conversation
… of the warnings module In the linecache module and in the Python implementation of the warnings module, a DeprecationWarning is issued when m.__loader__ differs from m.__spec__.loader (like in the C implementation of the warnings module).
@@ -0,0 +1,4 @@ | |||
In the :mod:`linecache` module and in the Python implementation of the | |||
:mod:`warnings` module, a ``DeprecationWarning`` is issued when | |||
``m.__loader__`` differs from ``m.__spec__.loader`` (like in the C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``m.__loader__`` differs from ``m.__spec__.loader`` (like in the C | |
``mod.__loader__`` differs from ``mod.__spec__.loader`` (like in the C |
return False | ||
|
||
if module_globals is not None and not isinstance(module_globals, dict): | ||
raise TypeError(f'module_globals must be a dict, not {type(module_globals).__name__}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise TypeError(f'module_globals must be a dict, not {type(module_globals).__name__}') | |
raise TypeError(f'module_globals must be a dict, not {type(module_globals).__qualname__}') |
Failed tests show that we may reconsider this deprecation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I just left minor comments.
DeprecationWarning) | ||
return loader | ||
|
||
assert spec_loader is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion looks redundant.
In the linecache module and in the Python implementation of the warnings module, a DeprecationWarning is issued when
m.__loader__
differs fromm.__spec__.loader
(like in the C implementation of the warnings module).