summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imp.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-05-11 21:29:03 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-05-11 21:29:03 (GMT)
commitaa6f688bd4f02b5d50c26cf649172672c1546d12 (patch)
tree9b10f869de5e6b472134d01dd5744bdfc758fb92 /Lib/test/test_imp.py
parentfeb51492442881994f8d42dddfac2763794dbaec (diff)
downloadcpython-aa6f688bd4f02b5d50c26cf649172672c1546d12.zip
cpython-aa6f688bd4f02b5d50c26cf649172672c1546d12.tar.gz
cpython-aa6f688bd4f02b5d50c26cf649172672c1546d12.tar.bz2
only close non-None files
Diffstat (limited to 'Lib/test/test_imp.py')
-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 96771d8..fe436f3 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:])