[pypy-svn] r17015 - in pypy/dist/pypy/lib: _fakecompiler _stablecompiler

tismer at codespeak.net tismer at codespeak.net
Sun Aug 28 18:28:31 CEST 2005


Author: tismer
Date: Sun Aug 28 18:28:30 2005
New Revision: 17015

Modified:
   pypy/dist/pypy/lib/_fakecompiler/fakecompiler.py
   pypy/dist/pypy/lib/_stablecompiler/apphook.py
Log:
reverted the _fakecompiler change to usemarshal, again.
This has two reasons:

- marshal is now always using the full depth of CPython's 5000
- using eval for such deep tuples gets even worse
- I want the interface file be always a marshal file, just for the
  case that wemight not have been able to run Python at all. Then
  the file is still valid, telling this by the done flag being false.

Modified: pypy/dist/pypy/lib/_fakecompiler/fakecompiler.py
==============================================================================
--- pypy/dist/pypy/lib/_fakecompiler/fakecompiler.py	(original)
+++ pypy/dist/pypy/lib/_fakecompiler/fakecompiler.py	Sun Aug 28 18:28:30 2005
@@ -16,8 +16,7 @@
 
 if __name__ == '__main__':
     s = file(DUMPFILE, "rb").read()
-    #tup = marshal.loads(s)
-    tup = eval(s)
+    tup = marshal.loads(s)
     tuples_or_src, filename, mode, done, flag_names = tup
     try:
         code = reallycompile(tuples_or_src, filename, mode, flag_names)

Modified: pypy/dist/pypy/lib/_stablecompiler/apphook.py
==============================================================================
--- pypy/dist/pypy/lib/_stablecompiler/apphook.py	(original)
+++ pypy/dist/pypy/lib/_stablecompiler/apphook.py	Sun Aug 28 18:28:30 2005
@@ -29,8 +29,11 @@
 def fakeapplevelcompile(tuples_or_src, filename, mode, flag_names):
     import os, marshal
     done = False
-    #data = marshal.dumps( (tuples_or_src, filename, mode, done, flag_names))
-    data = repr( (tuples_or_src, filename, mode, done, flag_names))
+    try:
+        data = marshal.dumps( (tuples_or_src, filename, mode, done, flag_names))
+    except ValueError:
+        raise ValueError, ("ST tuple too deeply nested for fake compiling!"
+                           " Please use the fakecompletely option")
     f = file(DUMPFILE, "wb")
     f.write(data)
     f.close()



More information about the Pypy-commit mailing list