diff --git a/test/bytecode_2.7.5/01_while1.pyc b/test/bytecode_2.7.5/01_while1.pyc new file mode 100644 index 00000000..5fc9ef90 Binary files /dev/null and b/test/bytecode_2.7.5/01_while1.pyc differ diff --git a/test/simple_source/bug275/01_while1.py b/test/simple_source/bug275/01_while1.py new file mode 100644 index 00000000..d7ef0649 --- /dev/null +++ b/test/simple_source/bug275/01_while1.py @@ -0,0 +1,9 @@ +# Issue #173. Bug is that 2.7.5 omits POP_BLOCK in +# in later 2.7 grammar. +# while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM +# while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE COME_FROM +# which is included in later code generation +ms=0 +if ms==1: + while 1: + pass diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index e1d74b22..c61e3f26 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -136,6 +136,11 @@ class Python27Parser(Python2Parser): whilestmt ::= SETUP_LOOP testexpr returns _come_froms POP_BLOCK COME_FROM + + # 2.7.5 (and before to 2.7.0?) + while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM + while1stmt ::= SETUP_LOOP l_stmts_opt CONTINUE COME_FROM + while1stmt ::= SETUP_LOOP returns bp_come_from while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK _come_froms