-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-94379: Remove zipimport find_loader() and find_module() methods #94380
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
Conversation
cc @brettcannon |
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.
The code removal looks fine, but the doc changes left out the removal of load_module()
as well.
When you're done making the requested changes, leave the comment: |
@brettcannon: I updated the PR to mention also load_module() removal, and fix test_zipimport... But now, I feel that I removed too many lines in the tests! Maybe the tests should be fixed instead? Problem: I don't know how to fix the packdir2 tests:
|
Doc/whatsnew/3.12.rst
Outdated
@@ -282,6 +282,10 @@ Removed | |||
a C implementation of :func:`~hashlib.pbkdf2_hmac()` which is faster. | |||
(Contributed by Victor Stinner in :gh:`94199`.) | |||
|
|||
* :mod:`zipimport`: Remove ``find_loader()``, ``find_module()`` and | |||
``load_module()`` methods, deprecated in Python 3.10. Use the ``find_spec()`` |
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.
find_spec()
only replaces find_loader()
and find_module()
, so this sentence is a bit misleading. Same is true for the news entry.
Lib/test/test_zipimport.py
Outdated
@@ -484,26 +470,12 @@ def testZipImporterMethods(self): | |||
spec.loader.exec_module(mod) | |||
self.assertEqual(zi.get_filename(TESTPACK), mod.__file__) | |||
|
|||
existing_pack_path = importlib.import_module(TESTPACK).__path__[0] |
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.
Why the test removals for lines that don't directly use the associated methods?
How is it failing? Maybe only do the |
Good idea! I modified this PR to only remove find_loader() and find_module() methods: keep load_module() for now (it can be removed in a separated PR). |
@brettcannon: Would you mind to review the updated PR? Now it only removes find_loader() and find_module() methods, and it only removes the bare minimum lines in test_zipimport.py. Once the PR gets approved, I will solve the Doc/whatsnew/3.12.rst conflict. |
@vstinner LGTM! And an FYI for anyone else who reviews, the |
zipimport: Remove find_loader() and find_module() methods, deprecated in Python 3.10: use the find_spec() method instead. See PEP 451 for the rationale.
Thanks for the reviews @warsaw and @brettcannon! It's easier to modify zipimport since @serhiy-storchaka rewrote it in pure Python :-) |
zipimport: Remove find_loader() and find_module() methods, deprecated
in Python 3.10. Use the find_spec()` method instead. See PEP 451 for
the rationale.