2.7 control-flow bug: except/pass in loop

This commit is contained in:
rocky
2017-11-25 22:12:19 -05:00
parent 566ef37ecc
commit 43cea023c4
3 changed files with 17 additions and 1 deletions

View File

@@ -150,7 +150,7 @@ pcheck-bytecode-2.6:
#: Check deparsing Python 2.7
check-bytecode-2.7:
$(PYTHON) test_pythonlib.py --bytecode-2.7 --verify
$(PYTHON) test_pythonlib.py --bytecode-2.7 --weak-verify
#: Check deparsing Python 3.0
check-bytecode-3.0:

View File

@@ -16,3 +16,17 @@ for a in [__name__]:
try:len(a)
except:continue
y = 2
# From 2.7.14 decimal.py
# Bug is in handling a CONTINUE op as a result of it being inside
# an except in a loop
def foo(self, error, ordered_errors, vals, funct, Signals):
for error in ordered_errors:
try:
funct(*vals)
except error:
pass
except Signals as e:
error = e
else:
error = 5

View File

@@ -53,6 +53,8 @@ class Python27Parser(Python2Parser):
except_cond2 ::= DUP_TOP expr COMPARE_OP
jmp_false POP_TOP designator POP_TOP
except_suite ::= c_stmts_opt CONTINUE
"""
def p_jump27(self, args):