You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Python 3.8 while and whileTrue loops
This commit is contained in:
BIN
test/bytecode_3.7/00_while_true_pass.pyc
Normal file
BIN
test/bytecode_3.7/00_while_true_pass.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.8/00_while_true_pass.pyc
Normal file
BIN
test/bytecode_3.8/00_while_true_pass.pyc
Normal file
Binary file not shown.
6
test/simple_source/bug38/00_while_true_pass.py
Normal file
6
test/simple_source/bug38/00_while_true_pass.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# The 3.8 bugs were in detecting
|
||||||
|
# 1) while True: pass
|
||||||
|
# 2) confusing the "if" ending in a loop jump with a "while"
|
||||||
|
if __name__:
|
||||||
|
while True:
|
||||||
|
pass
|
@@ -142,6 +142,7 @@ class Python38Parser(Python37Parser):
|
|||||||
while1stmt ::= _come_froms l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
|
while1stmt ::= _come_froms l_stmts COME_FROM JUMP_BACK COME_FROM_LOOP
|
||||||
whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK
|
whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK
|
||||||
whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK COME_FROM_EXCEPT_CLAUSE
|
whileTruestmt38 ::= _come_froms l_stmts JUMP_BACK COME_FROM_EXCEPT_CLAUSE
|
||||||
|
whileTruestmt38 ::= _come_froms pass JUMP_BACK
|
||||||
|
|
||||||
for_block ::= _come_froms l_stmts_opt _come_from_loops JUMP_BACK
|
for_block ::= _come_froms l_stmts_opt _come_from_loops JUMP_BACK
|
||||||
|
|
||||||
|
@@ -125,7 +125,10 @@ def customize_for_version38(self, version):
|
|||||||
(1, "testexpr"),
|
(1, "testexpr"),
|
||||||
(2, ("l_stmts", "pass")),
|
(2, ("l_stmts", "pass")),
|
||||||
),
|
),
|
||||||
"whileTruestmt38": ("%|while True:\n%+%c%-\n\n", (1, "l_stmts", "pass"),),
|
"whileTruestmt38": (
|
||||||
|
"%|while True:\n%+%c%-\n\n",
|
||||||
|
(1, ("l_stmts", "pass")),
|
||||||
|
),
|
||||||
"try_elsestmtl38": (
|
"try_elsestmtl38": (
|
||||||
"%|try:\n%+%c%-%c%|else:\n%+%c%-",
|
"%|try:\n%+%c%-%c%|else:\n%+%c%-",
|
||||||
(1, "suite_stmts_opt"),
|
(1, "suite_stmts_opt"),
|
||||||
|
Reference in New Issue
Block a user