diff --git a/test/bytecode_3.6/05_while_and_if.pyc b/test/bytecode_3.6/05_while_and_if.pyc new file mode 100644 index 00000000..65784291 Binary files /dev/null and b/test/bytecode_3.6/05_while_and_if.pyc differ diff --git a/test/simple_source/bug36/05_while_and_if.py b/test/simple_source/bug36/05_while_and_if.py new file mode 100644 index 00000000..f07c0c5e --- /dev/null +++ b/test/simple_source/bug36/05_while_and_if.py @@ -0,0 +1,13 @@ +# From Python 3.6 getopt.py +# Bug showing that "while" can have several "COME_FROMS" before loop end +# NOTE: uncompyle6 still gets the "if"s wrong. +def getopt(args): + while args and args[0] and args[0] != '-': + if args[0] == '--': + break + if args[0]: + opts = 5 + else: + opts = 6 + + return opts diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 3a4587b5..0391833c 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -47,7 +47,7 @@ class Python36Parser(Python35Parser): come_from_loops ::= COME_FROM_LOOP* whilestmt ::= SETUP_LOOP testexpr l_stmts_opt - JUMP_BACK COME_FROM POP_BLOCK COME_FROM_LOOP + JUMP_BACK come_froms POP_BLOCK COME_FROM_LOOP # This might be valid in < 3.6 and ::= expr jmp_false expr