diff --git a/test/bytecode_2.6/08_while1_if_continue.pyc b/test/bytecode_2.6/08_while1_if_continue.pyc new file mode 100644 index 00000000..51685e7d Binary files /dev/null and b/test/bytecode_2.6/08_while1_if_continue.pyc differ diff --git a/test/bytecode_2.7/08_while1_if_continue.pyc b/test/bytecode_2.7/08_while1_if_continue.pyc new file mode 100644 index 00000000..eb9a7df4 Binary files /dev/null and b/test/bytecode_2.7/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 new file mode 100644 index 00000000..3d72a7e8 --- /dev/null +++ b/test/simple_source/looping/08_while1_if_continue.py @@ -0,0 +1,9 @@ +# 2.6.9 text_file.py +# Bugs in 2.6 and 2.7 detecting structure +def readline (self): + while 1: + if self: + if __file__: + continue + + return diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 420a062a..51df0a32 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -145,7 +145,6 @@ class Python26Parser(Python2Parser): whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK else_suite COME_FROM - while1stmt ::= SETUP_LOOP return_stmts bp_come_from return_stmt ::= ret_expr RETURN_END_IF come_from_pop diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index cacf206b..7bb94890 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -50,6 +50,8 @@ class Python27Parser(Python2Parser): withasstmt ::= expr SETUP_WITH designator suite_stmts_opt POP_BLOCK LOAD_CONST COME_FROM WITH_CLEANUP END_FINALLY + + while1stmt ::= SETUP_LOOP l_stmts POP_BLOCK COME_FROM """ diff --git a/uncompyle6/scanners/scanner2.py b/uncompyle6/scanners/scanner2.py index 56c57ba4..ee2072bd 100755 --- a/uncompyle6/scanners/scanner2.py +++ b/uncompyle6/scanners/scanner2.py @@ -439,7 +439,7 @@ class Scanner2(scan.Scanner): # Is jump back really "back"? jump_target = self.get_target(jump_back, code[jump_back]) if (jump_target > jump_back or - code[jump_back+3] == self.opc.JUMP_FORWARD): + code[jump_back+3] in [self.opc.JUMP_FORWARD, self.opc.JUMP_ABSOLUTE]): jump_back = None pass else: