[pypy-svn] r12001 - in pypy/dist/pypy: interpreter translator/test

pedronis at codespeak.net pedronis at codespeak.net
Fri May 6 02:32:10 CEST 2005


Author: pedronis
Date: Fri May  6 02:32:10 2005
New Revision: 12001

Modified:
   pypy/dist/pypy/interpreter/compiler.py
   pypy/dist/pypy/translator/test/snippet.py
Log:
- fixes to code to convert host CPython compile syntax errors to PyPy exceptions.

- fix snippet so that test_geninterp works again



Modified: pypy/dist/pypy/interpreter/compiler.py
==============================================================================
--- pypy/dist/pypy/interpreter/compiler.py	(original)
+++ pypy/dist/pypy/interpreter/compiler.py	Fri May  6 02:32:10 2005
@@ -100,7 +100,12 @@
         # but here we only propagate the 'usual' ones, until we figure
         # out how to do it generically.
         except SyntaxError,e:
-            raise OperationError(space.w_SyntaxError,space.wrap(e.args))
+            w_synerr = space.newtuple([space.wrap(e.msg),
+                                       space.newtuple([space.wrap(e.filename),
+                                                       space.wrap(e.lineno),
+                                                       space.wrap(e.offset),
+                                                       space.wrap(e.text)])])
+            raise OperationError(space.w_SyntaxError, w_synerr)
         except ValueError,e:
             raise OperationError(space.w_ValueError,space.wrap(str(e)))
         except TypeError,e:

Modified: pypy/dist/pypy/translator/test/snippet.py
==============================================================================
--- pypy/dist/pypy/translator/test/snippet.py	(original)
+++ pypy/dist/pypy/translator/test/snippet.py	Fri May  6 02:32:10 2005
@@ -172,6 +172,7 @@
 def choose_last():
     """For loop test"""
     set = ["foo", "bar", "spam", "egg", "python"]
+    choice = ""
     for choice in set:
         pass
     return choice



More information about the Pypy-commit mailing list