[pypy-svn] r71996 - pypy/trunk/pypy/module/parser

arigo at codespeak.net arigo at codespeak.net
Tue Mar 9 19:56:11 CET 2010


Author: arigo
Date: Tue Mar  9 19:56:09 2010
New Revision: 71996

Modified:
   pypy/trunk/pypy/module/parser/pyparser.py
Log:
Fix.  Shown by test_parser from lib-python.


Modified: pypy/trunk/pypy/module/parser/pyparser.py
==============================================================================
--- pypy/trunk/pypy/module/parser/pyparser.py	(original)
+++ pypy/trunk/pypy/module/parser/pyparser.py	Tue Mar  9 19:56:09 2010
@@ -55,7 +55,15 @@
     def descr_compile(self, space, filename="<syntax-tree>"):
         info = pyparse.CompileInfo(filename, self.mode)
         ast = ast_from_node(space, self.tree, info)
-        return space.wrap(compile_ast(space, ast, info))
+        try:
+            result = compile_ast(space, ast, info)
+        except error.IndentationError, e:
+            raise OperationError(space.w_IndentationError,
+                                 e.wrap_info(space))
+        except error.SyntaxError, e:
+            raise OperationError(space.w_SyntaxError,
+                                 e.wrap_info(space))
+        return space.wrap(result)
     descr_compile.unwrap_spec = ["self", ObjSpace, str]
 
 STType.typedef = TypeDef("parser.st",



More information about the Pypy-commit mailing list