You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Adjust 3.6 "while" loop grammar
This commit is contained in:
BIN
test/bytecode_3.6/05_while_and_if.pyc
Normal file
BIN
test/bytecode_3.6/05_while_and_if.pyc
Normal file
Binary file not shown.
13
test/simple_source/bug36/05_while_and_if.py
Normal file
13
test/simple_source/bug36/05_while_and_if.py
Normal file
@@ -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
|
@@ -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
|
||||
|
Reference in New Issue
Block a user