diff options
author | Brett Cannon <brettcannon@users.noreply.github.com> | 2018-04-06 16:10:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-06 16:10:18 -0700 |
commit | 9e2be60634914f23db2ae5624e4acc9335bf5fea (patch) | |
tree | 9b1613b2c8bdad0fd942222c07a72e90e8dd509e /Lib/test/test_importlib/test_api.py | |
parent | 3a9ccee0e5dbf7d67f5ab79f6095755969db117c (diff) | |
download | cpython-9e2be60634914f23db2ae5624e4acc9335bf5fea.tar.gz cpython-9e2be60634914f23db2ae5624e4acc9335bf5fea.zip |
bpo-33169: Remove values of `None` from sys.path_importer_cache when invalidating caches (GH-6402)
An entry of None in sys.path_importer_cache represents a negative/missing finder for a path, so clearing it out makes sense.
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r-- | Lib/test/test_importlib/test_api.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index 8beb4244eac..edb745c2cd4 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -406,7 +406,7 @@ class InvalidateCacheTests: # There should be no issues if the method is not defined. key = 'gobbledeegook' sys.path_importer_cache[key] = None - self.addCleanup(lambda: sys.path_importer_cache.__delitem__(key)) + self.addCleanup(lambda: sys.path_importer_cache.pop(key, None)) self.init.invalidate_caches() # Shouldn't trigger an exception. |