Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3.3
Changeset: r75251:8c6a64ce91ed
Date: 2015-01-06 00:30 +0100
http://bitbucket.org/pypy/pypy/changeset/8c6a64ce91ed/
Log: Unskip test about ast.Try, and fix it.
diff --git a/pypy/interpreter/astcompiler/test/test_validate.py
b/pypy/interpreter/astcompiler/test/test_validate.py
--- a/pypy/interpreter/astcompiler/test/test_validate.py
+++ b/pypy/interpreter/astcompiler/test/test_validate.py
@@ -189,24 +189,23 @@
self.stmt(r, "must have Load context")
def test_try(self):
- skip("enable when parser uses the new Try construct")
p = ast.Pass(0, 0)
- t = ast.Try([], [], [], [p])
+ t = ast.Try([], [], [], [p], 0, 0)
self.stmt(t, "empty body on Try")
- t = ast.Try([ast.Expr(ast.Name("x", ast.Store, 0, 0), 0, 0)], [], [],
[p])
+ t = ast.Try([ast.Expr(ast.Name("x", ast.Store, 0, 0), 0, 0)], [], [],
[p], 0, 0)
self.stmt(t, "must have Load context")
- t = ast.Try([p], [], [], [])
+ t = ast.Try([p], [], [], [], 0, 0)
self.stmt(t, "Try has neither except handlers nor finalbody")
- t = ast.Try([p], [], [p], [p])
+ t = ast.Try([p], [], [p], [p], 0, 0)
self.stmt(t, "Try has orelse but no except handlers")
- t = ast.Try([p], [ast.ExceptHandler(None, "x", [])], [], [])
+ t = ast.Try([p], [ast.ExceptHandler(None, "x", [], 0, 0)], [], [], 0,
0)
self.stmt(t, "empty body on ExceptHandler")
- e = [ast.ExceptHandler(ast.Name("x", ast.Store, 0, 0), "y", [p])]
- self.stmt(ast.Try([p], e, [], []), "must have Load context")
- e = [ast.ExceptHandler(None, "x", [p])]
- t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store, 0, 0), 0, 0)],
[p])
+ e = [ast.ExceptHandler(ast.Name("x", ast.Store, 0, 0), "y", [p], 0, 0)]
+ self.stmt(ast.Try([p], e, [], [], 0, 0), "must have Load context")
+ e = [ast.ExceptHandler(None, "x", [p], 0, 0)]
+ t = ast.Try([p], e, [ast.Expr(ast.Name("x", ast.Store, 0, 0), 0, 0)],
[p], 0, 0)
self.stmt(t, "must have Load context")
- t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store, 0, 0), 0,
0)])
+ t = ast.Try([p], e, [p], [ast.Expr(ast.Name("x", ast.Store, 0, 0), 0,
0)], 0, 0)
self.stmt(t, "must have Load context")
def test_assert(self):
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
@@ -247,7 +247,7 @@
"Try has neither except handlers nor finalbody")
if not node.handlers and node.orelse:
raise ValidationError(
- "Try has orelse but not except handlers")
+ "Try has orelse but no 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