Files
python-uncompyle6/test/simple_source/bug26/02_except_as.py
rocky de594ce7f2 Remove 3-arg raise in 3.x and..
add tests in 2.x
2017-12-02 22:07:44 -05:00

26 lines
618 B
Python

# From 2.6.9 ConfigParser.py
# Note this can only be compiled in Python 2.x
#
# Bug was being able to handle:
# except KeyError, e
# vs 2.6+.
# except KeyError as e
#
# In terms of table syntax:
# 2.7+:
# 'except_cond2': ( '%|except %c as %c:\n', 1, 5 )
# vs 2.6 and before
# 'except_cond3': ( '%|except %c, %c:\n', 1, 6 )
#
# Python 2.6 allows both, but we use the older form since
# that matches the grammar for how this gets parsed
try:
value = "foo"
except RuntimeError:
# Test:
# raise_stmt3 ::= expr expr expr RAISE_VARARGS_3
raise 1, 2, 3
except KeyError, e:
raise RuntimeError('foo')