[pypy-commit] pypy py3k: convert the interp level TabError into an applevel one

antocuni noreply at buildbot.pypy.org
Wed Sep 19 17:06:44 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r57393:525b21072c09
Date: 2012-09-19 17:04 +0200
http://bitbucket.org/pypy/pypy/changeset/525b21072c09/

Log:	convert the interp level TabError into an applevel one

diff --git a/pypy/interpreter/pycompiler.py b/pypy/interpreter/pycompiler.py
--- a/pypy/interpreter/pycompiler.py
+++ b/pypy/interpreter/pycompiler.py
@@ -145,6 +145,9 @@
         try:
             parse_tree = self.parser.parse_source(source, info)
             mod = astbuilder.ast_from_node(space, parse_tree, info)
+        except parseerror.TabError, e:
+            raise OperationError(space.w_TabError,
+                                 e.wrap_info(space))
         except parseerror.IndentationError, e:
             raise OperationError(space.w_IndentationError,
                                  e.wrap_info(space))
diff --git a/pypy/interpreter/test/test_compiler.py b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -992,6 +992,17 @@
         else:
             raise Exception("DID NOT RAISE")
 
+    def test_taberror(self):
+        source = """if 1:
+        x
+    \ty
+        """
+        try:
+            exec(source)
+        except TabError as e:
+            pass
+        else:
+            raise Exception("DID NOT RAISE")
 
     def test_repr_vs_str(self):
         source1 = "x = (\n"


More information about the pypy-commit mailing list