Commit abb7a118 authored by Stefan Behnel's avatar Stefan Behnel

fix except-as syntax to match Py3

parent d0c3b6a2
...@@ -1335,13 +1335,11 @@ def p_except_clause(s): ...@@ -1335,13 +1335,11 @@ def p_except_clause(s):
s.next() s.next()
exc_value = p_simple_expr(s) exc_value = p_simple_expr(s)
elif s.sy == 'IDENT' and s.systring == 'as': elif s.sy == 'IDENT' and s.systring == 'as':
## XXX In Python 3, it should be: # Py3 syntax requires a name here
## s.next()
## pos2 = s.position()
## name = p_ident(s)
## exc_value = ExprNodes.NameNode(pos2, name = name)
s.next() s.next()
exc_value = p_simple_expr(s) pos2 = s.position()
name = p_ident(s)
exc_value = ExprNodes.NameNode(pos2, name = name)
body = p_suite(s) body = p_suite(s)
return Nodes.ExceptClauseNode(pos, return Nodes.ExceptClauseNode(pos,
pattern = exc_type, target = exc_value, body = body) pattern = exc_type, target = exc_value, body = body)
......
...@@ -76,9 +76,9 @@ def g(a, b, c, x): ...@@ -76,9 +76,9 @@ def g(a, b, c, x):
try: try:
i = 1 i = 1
except (a, b) as c[42]: except (a, b) as c:
i = 2 i = 2
except (b, a) as c.x: except (b, a) as c:
i = 3 i = 3
except: except:
i = 4 i = 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment