Commits

Philip Jenvey committed 4cbca19

close it when finished
(grafted from 308ded060ac8ffbf1b1a16d88486558980b4bc1b)

  • Participants
  • Parent commits 36af1cd
  • Branches py3k-fix-strategies

Comments (0)

Files changed (1)

File lib_pypy/_testcapi.py

-import imp, os
+import imp
+import os
 
 try:
     import cpyext
 
 try:
     fp, filename, description = imp.find_module('_testcapi', path=[output_dir])
-    imp.load_module('_testcapi', fp, filename, description)
+    try:
+        imp.load_module('_testcapi', fp, filename, description)
+    finally:
+        fp.close()
 except ImportError:
     _pypy_testcapi.compile_shared(cfile, '_testcapi', output_dir)