Adjust that 2.2-2.6 "while" may not have COME_FROM

This commit is contained in:
rocky
2018-03-05 00:21:54 -05:00
parent d42858cae4
commit fac5d31f34
3 changed files with 14 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,13 @@
# From 2.3.7 dis.py. Bug ranged from 2.2 to 2.6.
# bug was in "while". uncompyle6 doesn't
# add in a COME_FROM after the while. Maybe it should?
def distb(tb=None):
"""Disassemble a traceback (default: last traceback)."""
if tb is None:
try:
tb = sys.last_traceback
except AttributeError:
raise RuntimeError, "no last traceback to disassemble"
while tb.tb_next: tb = tb.tb_next
disassemble(tb.tb_frame.f_code, tb.tb_lasti)

View File

@@ -139,6 +139,7 @@ class Python26Parser(Python2Parser):
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _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 whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop POP_BLOCK
whilestmt ::= SETUP_LOOP testexpr returns POP_BLOCK COME_FROM whilestmt ::= SETUP_LOOP testexpr returns POP_BLOCK COME_FROM
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK