diff --git a/test/bytecode_2.3/08_while1_if_continue.pyc b/test/bytecode_2.3/08_while1_if_continue.pyc index a2d50a56..4b236806 100644 Binary files a/test/bytecode_2.3/08_while1_if_continue.pyc and b/test/bytecode_2.3/08_while1_if_continue.pyc differ diff --git a/test/bytecode_2.4/08_while1_if_continue.pyc b/test/bytecode_2.4/08_while1_if_continue.pyc index 9cf18747..69e9e905 100644 Binary files a/test/bytecode_2.4/08_while1_if_continue.pyc and b/test/bytecode_2.4/08_while1_if_continue.pyc differ diff --git a/test/bytecode_2.6/08_while1_if_continue.pyc b/test/bytecode_2.6/08_while1_if_continue.pyc index 7d47699d..34a3b332 100644 Binary files a/test/bytecode_2.6/08_while1_if_continue.pyc and b/test/bytecode_2.6/08_while1_if_continue.pyc differ diff --git a/test/simple_source/looping/08_while1_if_continue.py b/test/simple_source/looping/08_while1_if_continue.py index eba6ead7..de4dd758 100644 --- a/test/simple_source/looping/08_while1_if_continue.py +++ b/test/simple_source/looping/08_while1_if_continue.py @@ -9,7 +9,8 @@ def readline (self): return # From 2.4.6 sre.py -# Bug in 2.4 and 2.3 was parsing the nested "while 1" with a "break" in it +# Bug has to do with "break" not being recognized +# and is a JUMP_FORWARD. def _parse(a, b, source, state): while 1: if b: @@ -17,3 +18,29 @@ def _parse(a, b, source, state): break else: raise + +def _parse2(source, state): + while 1: + if a: + if b: + while 1: + this = 1 + break + continue + + while 1: + if b: + break + + x = 3 + +# Bug was in 2.3 decompilation +def _parse3(source, state): + while 1: + if a: + if b: + x = 1 + while 1: + if a: + break + raise diff --git a/uncompyle6/parsers/parse23.py b/uncompyle6/parsers/parse23.py index a9f3b5c2..2411cd58 100644 --- a/uncompyle6/parsers/parse23.py +++ b/uncompyle6/parsers/parse23.py @@ -45,6 +45,8 @@ class Python23Parser(Python24Parser): # a "break" inside "l_stmts". while1stmt ::= _while1test l_stmts COME_FROM JUMP_BACK POP_TOP POP_BLOCK COME_FROM + while1stmt ::= _while1test l_stmts JUMP_BACK + POP_TOP POP_BLOCK list_comp ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR store list_iter del_stmt list_for ::= expr for_iter store list_iter JUMP_BACK come_froms POP_TOP JUMP_BACK diff --git a/uncompyle6/parsers/parse24.py b/uncompyle6/parsers/parse24.py index 411daaad..2d3b932c 100644 --- a/uncompyle6/parsers/parse24.py +++ b/uncompyle6/parsers/parse24.py @@ -43,6 +43,8 @@ class Python24Parser(Python25Parser): while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_TOP POP_BLOCK + continue ::= JUMP_BACK JUMP_ABSOLUTE + # Python 2.4 # The following has no "JUMP_BACK" after l_stmts because # l_stmts ends in a "break", "return", or "continue"