-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-121342: Fixed pkgutil.iter_zipimport_modules
on an invalidated cache (#121342)
#121705
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?
Conversation
35bc2ba
to
7e655ab
Compare
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.
Only a few formatting nitpicks. Failing CI is caused by pkgutil.iter_zipimport_modules
being undocumented. Ideally, you should document it with this PR.
Lib/test/test_pkgutil.py
Outdated
@@ -522,6 +522,54 @@ def test_mixed_namespace(self): | |||
del sys.modules['foo.bar'] | |||
del sys.modules['foo.baz'] | |||
|
|||
|
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.
Only one blank line between methods, per PEP 8
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.
Removed the blank line. Also, I've learned that you prefer not to have force-pushes on CPython PRs. I'll respect that for future PRs. :)
…ated cache (python#121342) It is no longer safe to directly access `zipimport._zip_directory_cache` since python#103208. It is not guaranteed that the cache is acutally filled. This changed fixes this by using the internal method `_get_files` instead, which may not be the best solution, but fixes the issue.
7e655ab
to
1e52c23
Compare
Added documentation to that, but now the CI complaints that |
As `pkgutil.iter_zipimport_modules` isn't supposed to be consumed directly by anything other than `pkgutils` itself, and is registered via as an importer module for `zipimporter`, I've decided to not include it in the public documentation. Thus, the `:func:` reference of `pkgutil.iter_zipimport_modules` in the news file is removed now.
Ah, it wasn't clear to me that the public documentation and the docstrings are a separate thing. As |
It is no longer safe to directly access
zipimport._zip_directory_cache
since #103208. It is not guaranteed that the cache is acutally filled. This changed fixes this by using the internal method_get_files
instead, which may not be the best solution, but fixes the issue.