Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r75222:22011d79ba65
Date: 2015-01-01 22:38 +0100
http://bitbucket.org/pypy/pypy/changeset/22011d79ba65/

Log:    Add move validation for ast.Try

diff --git a/pypy/interpreter/astcompiler/validate.py 
b/pypy/interpreter/astcompiler/validate.py
--- a/pypy/interpreter/astcompiler/validate.py
+++ b/pypy/interpreter/astcompiler/validate.py
@@ -242,6 +242,12 @@
 
     def visit_Try(self, node):
         self._validate_body(node.body, "Try")
+        if not node.handlers and not node.finalbody:
+            raise ValidationError(
+                "Try has neither except handlers nor finalbody")
+        if not node.handlers and node.orelse:
+            raise ValidationError(
+                "Try has orelse but not except handlers")
         for handler in node.handlers:
             handler.walkabout(self)
         self._validate_stmts(node.orelse)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to