From 0e62d515258d29d5df2e4dd159f5aca0492cb2d1 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 14 Aug 2024 23:00:08 -0400 Subject: [PATCH] gh-121735: Allow all modules to be processed by the ZipReader. --- Lib/zipimport.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Lib/zipimport.py b/Lib/zipimport.py index f2724dd0268358..b7c4890860a4f5 100644 --- a/Lib/zipimport.py +++ b/Lib/zipimport.py @@ -256,17 +256,9 @@ def load_module(self, fullname): 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)