-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
gh-125746: Delay deprecated zipimport.zipimporter.load_module
removal time to 3.15
#125748
base: main
Are you sure you want to change the base?
Conversation
I also encountered this problem, but I don't know why it happened. I opened an issue. |
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.
I would like to postpone this until 3.15. Please update the PR to move the load_module
deprecation to pending-removal-in-3.15
zipimport.zipimporter.load_module
zipimport.zipimporter.load_module
removal time to 3.15
You're right, when I did this pr, my vscode (the latest Python extension) didn't prompt exec_module either. I will edit the pending-removal-in-3.15.rst and Lib/zipimport.py to remove the entries for pending-removal-in-future.rst |
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.
Thank you! LGTM.
Lib/zipimport.py
Outdated
@@ -222,7 +222,7 @@ def load_module(self, fullname): | |||
Deprecated since Python 3.10. Use exec_module() instead. | |||
""" | |||
msg = ("zipimport.zipimporter.load_module() is deprecated and slated for " | |||
"removal in Python 3.12; use exec_module() instead") | |||
"removal in Python 3.15; use exec_module() instead") |
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.
We should probably update this to use warnings._deprecated()
.
Lines 650 to 668 in 5b7a872
_DEPRECATED_MSG = "{name!r} is deprecated and slated for removal in Python {remove}" | |
def _deprecated(name, message=_DEPRECATED_MSG, *, remove, _version=sys.version_info): | |
"""Warn that *name* is deprecated or should be removed. | |
RuntimeError is raised if *remove* specifies a major/minor tuple older than | |
the current Python version or the same version but past the alpha. | |
The *message* argument is formatted with *name* and *remove* as a Python | |
version tuple (e.g. (3, 11)). | |
""" | |
remove_formatted = f"{remove[0]}.{remove[1]}" | |
if (_version[:2] > remove) or (_version[:2] == remove and _version[3] != "alpha"): | |
msg = f"{name!r} was slated for removal after Python {remove_formatted} alpha" | |
raise RuntimeError(msg) | |
else: | |
msg = message.format(name=name, remove=remove_formatted) | |
warn(msg, DeprecationWarning, stacklevel=3) |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
test_cmd_line_script test failed but I don't know why. It appears that there is no relevant code here, only the use of the |
Thanks for making the requested changes! @brettcannon: please review the changes made to this pull request. |
Co-authored-by: Brett Cannon <[email protected]>
#125746 (comment)
zipimport.zipimporter.load_module
removal time to 3.15 #125746📚 Documentation preview 📚: https://cpython-previews--125748.org.readthedocs.build/