mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
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.
This commit is contained in:
parent
3bd942f106
commit
ba687d9481
40 changed files with 225 additions and 263 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue