summaryrefslogtreecommitdiffstats
path: root/Lib/zipimport.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2021-09-18 00:46:22 (GMT)
committerGitHub <noreply@github.com>2021-09-18 00:46:22 (GMT)
commite1bdecb6dc7ac33256d5fa875d45634512d2a90e (patch)
tree16ee13faa6339c9acd6846ccfeaacdc4d979189b /Lib/zipimport.py
parent397dad4001cd402cf4843ab44963932ea81c2e73 (diff)
downloadcpython-e1bdecb6dc7ac33256d5fa875d45634512d2a90e.zip
cpython-e1bdecb6dc7ac33256d5fa875d45634512d2a90e.tar.gz
cpython-e1bdecb6dc7ac33256d5fa875d45634512d2a90e.tar.bz2
[3.10] bpo-45183: don't raise an exception when calling zipimport.zipimporter.find_spec() when the zip file is missing and the internal cache has been reset (GH-28435) (#28438)
This can occur when the zip file gets deleted, you call zipimport.zipimporter.invalidate_cache(), and then try to use zipimport.zipimporter.find_spec() (i.e. you left the zip file path on sys.path). (cherry picked from commit 209b7035f714dcc41df054b0b023e0b955d7e1a2) Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Lib/zipimport.py')
-rw-r--r--Lib/zipimport.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipimport.py b/Lib/zipimport.py
index c55fec6..25eaee9 100644
--- a/Lib/zipimport.py
+++ b/Lib/zipimport.py
@@ -334,7 +334,7 @@ class zipimporter(_bootstrap_external._LoaderBasics):
_zip_directory_cache[self.archive] = self._files
except ZipImportError:
_zip_directory_cache.pop(self.archive, None)
- self._files = None
+ self._files = {}
def __repr__(self):