diff --git a/test/bytecode_3.6/09_while_if_while.pyc b/test/bytecode_3.6/09_while_if_while.pyc new file mode 100644 index 00000000..bef73d47 Binary files /dev/null and b/test/bytecode_3.6/09_while_if_while.pyc differ diff --git a/test/simple_source/bug36/09_while_if_while.py b/test/simple_source/bug36/09_while_if_while.py new file mode 100644 index 00000000..8e74d01d --- /dev/null +++ b/test/simple_source/bug36/09_while_if_while.py @@ -0,0 +1,9 @@ +# From 3.6 _markupbase.py +# Bug was parsing the inner while +def _parse_doctype_subset(c, j, rawdata, n): + while n: + if c: + j += 1 + while j < n and rawdata[j]: + j += 1 + return -1 diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 9e809b4b..ba81bab5 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -30,6 +30,8 @@ class Python36Parser(Python35Parser): for_block ::= l_stmts_opt come_from_loops JUMP_BACK come_from_loops ::= COME_FROM_LOOP* + whilestmt ::= SETUP_LOOP testexpr l_stmts_opt + JUMP_BACK COME_FROM POP_BLOCK COME_FROM_LOOP # This might be valid in < 3.6 and ::= expr jmp_false expr