]> granicus.if.org Git - python/commitdiff
close open file from find_module()
authorBenjamin Peterson <benjamin@python.org>
Sat, 30 Oct 2010 23:06:57 +0000 (23:06 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sat, 30 Oct 2010 23:06:57 +0000 (23:06 +0000)
Lib/test/test_import.py

index 10b32d35d11a1dd5e2afc45f2fbe88654adea42c..02f56e6217c8784e25cd263d541b32344d175994 100644 (file)
@@ -128,6 +128,7 @@ class ImportTests(unittest.TestCase):
         orig_getenv = os.getenv
         with EnvironmentVarGuard():
             x = imp.find_module("os")
+            self.addCleanup(x[0].close)
             new_os = imp.load_module("os", *x)
             self.assertIs(os, new_os)
             self.assertIs(orig_path, new_os.path)