Bugs found in 2.4 branch testing

This commit is contained in:
rocky
2020-02-14 10:54:37 -05:00
parent 534afb3f6e
commit fd36c77d2d
7 changed files with 38 additions and 4 deletions

Binary file not shown.

View File

@@ -7,3 +7,13 @@ def readline (self):
continue
return
# From 2.4.6 sre.py
# Bug in 2.4 and 2.3 was parsing the nested "while 1" with a "break" in it
def _parse(a, b, source, state):
while 1:
if b:
while 1:
break
else:
raise

View File

@@ -32,8 +32,19 @@ class Python23Parser(Python24Parser):
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
COME_FROM POP_TOP POP_BLOCK COME_FROM
while1stmt ::= _while1test l_stmts_opt JUMP_BACK COME_FROM
POP_TOP POP_BLOCK COME_FROM
# Python 2.3
# The following has no "JUMP_BACK" after l_stmts because
# l_stmts ends in a "break", "return", or "continue"
while1stmt ::= _while1test l_stmts
POP_TOP POP_BLOCK
# The following has a "COME_FROM" at the end which comes from
# a "break" inside "l_stmts".
while1stmt ::= _while1test l_stmts COME_FROM JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
list_comp ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR store list_iter del_stmt
list_for ::= expr for_iter store list_iter JUMP_BACK come_froms POP_TOP JUMP_BACK

View File

@@ -38,8 +38,21 @@ class Python24Parser(Python25Parser):
_ifstmts_jump24 ::= c_stmts_opt JUMP_FORWARD POP_TOP
# Python 2.5+ omits POP_TOP POP_BLOCK
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK COME_FROM
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK
# Python 2.4
# The following has no "JUMP_BACK" after l_stmts because
# l_stmts ends in a "break", "return", or "continue"
while1stmt ::= SETUP_LOOP l_stmts
POP_TOP POP_BLOCK
# The following has a "COME_FROM" at the end which comes from
# a "break" inside "l_stmts".
while1stmt ::= SETUP_LOOP l_stmts COME_FROM JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
# Python 2.5+:
# call_stmt ::= expr POP_TOP