diff --git a/test/bytecode_2.3/09_whiletrue_bug.pyc b/test/bytecode_2.3/09_whiletrue_bug.pyc index 09b3a9bb..0c276496 100644 Binary files a/test/bytecode_2.3/09_whiletrue_bug.pyc and b/test/bytecode_2.3/09_whiletrue_bug.pyc differ diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index cec08167..b3899a23 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -43,6 +43,7 @@ class Python2Parser(PythonParser): def p_stmt2(self, args): """ while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM + exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT exec_stmt ::= expr exprlist EXEC_STMT diff --git a/uncompyle6/parsers/parse23.py b/uncompyle6/parsers/parse23.py index d3a3ba1d..f39f7954 100644 --- a/uncompyle6/parsers/parse23.py +++ b/uncompyle6/parsers/parse23.py @@ -14,9 +14,11 @@ class Python23Parser(Python24Parser): def p_misc23(self, args): ''' - _while1test ::= JUMP_FORWARD JUMP_IF_FALSE POP_TOP COME_FROM + # Used to keep semantic positions the same across later versions + # of Python + _while1test ::= SETUP_LOOP JUMP_FORWARD JUMP_IF_FALSE POP_TOP COME_FROM - while1stmt ::= SETUP_LOOP _while1test l_stmts JUMP_BACK + while1stmt ::= _while1test l_stmts_opt JUMP_BACK COME_FROM POP_TOP POP_BLOCK COME_FROM list_compr ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR designator list_iter del_stmt diff --git a/uncompyle6/parsers/parse24.py b/uncompyle6/parsers/parse24.py index 579fe4ce..92a798a2 100644 --- a/uncompyle6/parsers/parse24.py +++ b/uncompyle6/parsers/parse24.py @@ -26,6 +26,7 @@ class Python24Parser(Python25Parser): # Python 2.5+ omits POP_TOP POP_BLOCK while1stmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_TOP POP_BLOCK COME_FROM + while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK COME_FROM # Python 2.5+: # call_stmt ::= expr POP_TOP