diff --git a/test/bytecode_3.8/03_while_bug.pyc b/test/bytecode_3.8/03_while_bug.pyc new file mode 100644 index 00000000..20a2d6d1 Binary files /dev/null and b/test/bytecode_3.8/03_while_bug.pyc differ diff --git a/test/simple_source/bug38/03_while_bug.py b/test/simple_source/bug38/03_while_bug.py new file mode 100644 index 00000000..4ed198b6 --- /dev/null +++ b/test/simple_source/bug38/03_while_bug.py @@ -0,0 +1,9 @@ +# See https://github.com/rocky/python-uncompyle6/issues/498 +# Bug was in not allowing _stmts in whilestmt38 +import time + +r = 0 +while r == 1: + print(time.time()) + if r == 1: + r = 0 diff --git a/uncompyle6/semantics/customize38.py b/uncompyle6/semantics/customize38.py index 7bdfaae6..89063590 100644 --- a/uncompyle6/semantics/customize38.py +++ b/uncompyle6/semantics/customize38.py @@ -144,7 +144,7 @@ def customize_for_version38(self, version): "whilestmt38": ( "%|while %c:\n%+%c%-\n\n", (1, ("bool_op", "testexpr", "testexprc")), - (2, ("l_stmts", "l_stmts_opt", "pass")), + (2, ("_stmts", "l_stmts", "l_stmts_opt", "pass")), ), "whileTruestmt38": ( "%|while True:\n%+%c%-\n\n",