Adjust 3.6 "while" loop grammar

This commit is contained in:
rocky
2018-03-19 06:01:39 -04:00
parent 94038151f4
commit 56b2e17e30
3 changed files with 14 additions and 1 deletions

Binary file not shown.

View 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

View File

@@ -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