summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_api.py
diff options
context:
space:
mode:
authorBrett Cannon <brettcannon@users.noreply.github.com>2018-04-07 00:02:18 (GMT)
committerGitHub <noreply@github.com>2018-04-07 00:02:18 (GMT)
commita09bb87c1eebb07b01b8105cf536704893aec565 (patch)
tree1b2003bef18312f6230a13e93acec7a5047d19a4 /Lib/test/test_importlib/test_api.py
parent3c193cf8afce525b1283986f113de0e16f23e115 (diff)
downloadcpython-a09bb87c1eebb07b01b8105cf536704893aec565.zip
cpython-a09bb87c1eebb07b01b8105cf536704893aec565.tar.gz
cpython-a09bb87c1eebb07b01b8105cf536704893aec565.tar.bz2
[3.7] bpo-33169: Remove values of `None` from sys.path_importer_cache when invalidating caches (GH-6402) (GH-6403)
An entry of None in sys.path_importer_cache represents a negative/missing finder for a path, so clearing it out makes sense. (cherry picked from commit 9e2be60634914f23db2ae5624e4acc9335bf5fea)
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r--Lib/test/test_importlib/test_api.py2
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 8beb424..edb745c 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.