gh-121342: Fixed pkgutil.iter_zipimport_modules on an invalidated cache (#121342)#121705
gh-121342: Fixed pkgutil.iter_zipimport_modules on an invalidated cache (#121342)#121705beachmachine wants to merge 3 commits intopython:mainfrom
pkgutil.iter_zipimport_modules on an invalidated cache (#121342)#121705Conversation
35bc2ba to
7e655ab
Compare
ZeroIntensity
left a comment
There was a problem hiding this comment.
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
| del sys.modules['foo.bar'] | ||
| del sys.modules['foo.baz'] | ||
|
|
||
|
|
There was a problem hiding this comment.
Only one blank line between methods, per PEP 8
There was a problem hiding this comment.
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_cachesince #103208. It is not guaranteed that the cache is acutally filled. This changed fixes this by using the internal method_get_filesinstead, which may not be the best solution, but fixes the issue.