You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Python 2.6 while1 if/and handling
This commit is contained in:
BIN
test/bytecode_2.6/02_while1_if_and.pyc
Normal file
BIN
test/bytecode_2.6/02_while1_if_and.pyc
Normal file
Binary file not shown.
8
test/simple_source/bug26/02_while1_if_and.py
Normal file
8
test/simple_source/bug26/02_while1_if_and.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# From 2.6.9 ftplib.py
|
||||
# Bug was handling if with "and' inside while1
|
||||
def getmultiline(line):
|
||||
if line[3]:
|
||||
while 1:
|
||||
if line[2] and line[5]:
|
||||
break
|
||||
return
|
@@ -134,12 +134,11 @@ class Python26Parser(Python2Parser):
|
||||
setup_finally ::= STORE_FAST SETUP_FINALLY LOAD_FAST DELETE_FAST
|
||||
setup_finally ::= STORE_NAME SETUP_FINALLY LOAD_NAME DELETE_NAME
|
||||
|
||||
while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK COME_FROM
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK _come_froms
|
||||
|
||||
# Sometimes JUMP_BACK is misclassified as CONTINUE.
|
||||
# workaround until we have better control flow in place
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE _come_froms
|
||||
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _come_froms
|
||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from
|
||||
@@ -154,13 +153,11 @@ class Python26Parser(Python2Parser):
|
||||
return ::= ret_expr RETURN_VALUE POP_TOP
|
||||
return_if_stmt ::= ret_expr RETURN_END_IF POP_TOP
|
||||
|
||||
iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK come_from_pop
|
||||
iflaststmtl ::= testexpr c_stmts_opt jb_cf_pop
|
||||
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE come_from_pop
|
||||
|
||||
lastc_stmt ::= iflaststmt COME_FROM
|
||||
|
||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM
|
||||
|
||||
ifstmt ::= testexpr_then _ifstmts_jump
|
||||
|
||||
# Semantic actions want the else to be at position 3
|
||||
|
Reference in New Issue
Block a user