From aa6f688bd4f02b5d50c26cf649172672c1546d12 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 11 May 2013 16:29:03 -0500 Subject: [PATCH] only close non-None files --- Lib/test/test_imp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py index 96771d8ba53..fe436f39850 100644 --- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -241,7 +241,8 @@ def test_load_module_extension_file_is_None(self): # 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:])