diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2024-09-11 22:33:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 22:33:07 -0400 |
commit | ba687d9481c04fd160795ff8d8568f5c9f877128 (patch) | |
tree | 03845d8195b86add0ced1e72f55b1e556c0c5b80 /Lib/zipimport.py | |
parent | 3bd942f106aa36c261a2d90104c027026b2a8fb6 (diff) | |
download | cpython-ba687d9481c04fd160795ff8d8568f5c9f877128.tar.gz cpython-ba687d9481c04fd160795ff8d8568f5c9f877128.zip |
gh-121735: Fix module-adjacent references in zip files (#123037)
* gh-116608: Apply style and compatibility changes from importlib_metadata.
* gh-121735: Ensure module-adjacent resources are loadable from a zipfile.
* gh-121735: Allow all modules to be processed by the ZipReader.
* Add blurb
* Remove update-zips script, unneeded.
* Remove unnecessary references to removed static fixtures.
* Remove zipdata fixtures, unused.
Diffstat (limited to 'Lib/zipimport.py')
-rw-r--r-- | Lib/zipimport.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Lib/zipimport.py b/Lib/zipimport.py index 7ceae2b7387..e5192c4d074 100644 --- a/Lib/zipimport.py +++ b/Lib/zipimport.py @@ -256,17 +256,9 @@ class zipimporter(_bootstrap_external._LoaderBasics): def get_resource_reader(self, fullname): - """Return the ResourceReader for a package in a zip file. - - If 'fullname' is a package within the zip file, return the - 'ResourceReader' object for the package. Otherwise return None. - """ - try: - if not self.is_package(fullname): - return None - except ZipImportError: - return None + """Return the ResourceReader for a module in a zip file.""" from importlib.readers import ZipReader + return ZipReader(self, fullname) |