[pypy-svn] r16335 - pypy/dist/pypy/lib/_stablecompiler

tismer at codespeak.net tismer at codespeak.net
Tue Aug 23 20:06:01 CEST 2005


Author: tismer
Date: Tue Aug 23 20:06:01 2005
New Revision: 16335

Modified:
   pypy/dist/pypy/lib/_stablecompiler/apphook.py
Log:
not explicitly closing files is not RPython ATM.

Modified: pypy/dist/pypy/lib/_stablecompiler/apphook.py
==============================================================================
--- pypy/dist/pypy/lib/_stablecompiler/apphook.py	(original)
+++ pypy/dist/pypy/lib/_stablecompiler/apphook.py	Tue Aug 23 20:06:01 2005
@@ -30,9 +30,13 @@
     import os, marshal
     done = False
     data = marshal.dumps( (tuples, filename, mode, done) )
-    file(DUMPFILE, "wb").write(data)
+    f = file(DUMPFILE, "wb")
+    f.write(data)
+    f.close()
     os.system('%s fakecompiler.py' % get_python())
-    data = file(DUMPFILE, "rb").read()
+    f = file(DUMPFILE, "rb")
+    data = f.read()
+    f.close()
     code, filename, mode, done = marshal.loads(data)
     if not done:
         raise ValueError, "could not fake compile!"
@@ -40,6 +44,8 @@
 
 def get_python():
     try:
-        return file('pythonname').read().strip()
+        f = file('pythonname')
+        res = f.read().strip()
+        f.close()
     except IOError:
         raise ValueError, "I need a local file 'pythonname'"



More information about the Pypy-commit mailing list