summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-05-11 16:29:03 -0500
committerBenjamin Peterson <benjamin@python.org>2013-05-11 16:29:03 -0500
commitaa6f688bd4f02b5d50c26cf649172672c1546d12 (patch)
tree9b10f869de5e6b472134d01dd5744bdfc758fb92
parentfeb51492442881994f8d42dddfac2763794dbaec (diff)
downloadcpython-git-aa6f688bd4f02b5d50c26cf649172672c1546d12.tar.gz
only close non-None files
-rw-r--r--Lib/test/test_imp.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 96771d8ba5..fe436f3985 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -241,7 +241,8 @@ class ImportTests(unittest.TestCase):
# Issue #15902
name = '_heapq'
found = imp.find_module(name)
- found[0].close()
+ if found[0] is not None:
+ found[0].close()
if found[2][2] != imp.C_EXTENSION:
return
imp.load_module(name, None, *found[1:])