diff --git a/test/bytecode_2.6/08_distbug.pyc b/test/bytecode_2.6/08_distbug.pyc new file mode 100644 index 00000000..e5aa7200 Binary files /dev/null and b/test/bytecode_2.6/08_distbug.pyc differ diff --git a/test/simple_source/bug26/08_distbug.py b/test/simple_source/bug26/08_distbug.py new file mode 100644 index 00000000..f85227fe --- /dev/null +++ b/test/simple_source/bug26/08_distbug.py @@ -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) diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 7268ab8e..3a155572 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -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_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 whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK