You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-02 16:44:46 +08:00
Fix 3.8 grammar rule bug: "for" with "if"/"return"
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
# from mult_by_const/instruction.py
|
# from mult_by_const/instruction.py
|
||||||
# Bug in 3.8 was handling no JUMP_BACK in "for" loop. It is
|
# Bug in 3.8 was handling no JUMP_BACK in "for" loop. It is
|
||||||
# in the "if" instead
|
# in the "if" instead
|
||||||
|
|
||||||
|
# RUNNABLE!
|
||||||
def instruction_sequence_value(instrs, a, b):
|
def instruction_sequence_value(instrs, a, b):
|
||||||
for instr in instrs:
|
for instr in instrs:
|
||||||
if a:
|
if a:
|
||||||
|
@@ -85,7 +85,7 @@ class Python38Parser(Python37Parser):
|
|||||||
|
|
||||||
# 3.8 can push a looping JUMP_BACK into into a JUMP_ from a statement that jumps to it
|
# 3.8 can push a looping JUMP_BACK into into a JUMP_ from a statement that jumps to it
|
||||||
lastl_stmt ::= ifpoplaststmtl
|
lastl_stmt ::= ifpoplaststmtl
|
||||||
ifpoplaststmtl ::= testexpr POP_TOP c_stmts_opt JUMP_BACK
|
ifpoplaststmtl ::= testexpr POP_TOP c_stmts_opt
|
||||||
ifelsestmtl ::= testexpr c_stmts_opt jb_cfs else_suitel JUMP_BACK come_froms
|
ifelsestmtl ::= testexpr c_stmts_opt jb_cfs else_suitel JUMP_BACK come_froms
|
||||||
|
|
||||||
# Keep indices the same in ifelsestmtl
|
# Keep indices the same in ifelsestmtl
|
||||||
|
@@ -471,19 +471,19 @@ MAP_R0 = (TABLE_R0, -1, 0)
|
|||||||
MAP_R = (TABLE_R, -1)
|
MAP_R = (TABLE_R, -1)
|
||||||
|
|
||||||
MAP = {
|
MAP = {
|
||||||
'stmt': MAP_R,
|
"stmt": MAP_R,
|
||||||
'call': MAP_R,
|
"call": MAP_R,
|
||||||
'del_stmt': MAP_R,
|
"del_stmt": MAP_R,
|
||||||
'store': MAP_R,
|
"store": MAP_R,
|
||||||
'exprlist': MAP_R0,
|
"exprlist": MAP_R0,
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSIGN_TUPLE_PARAM = lambda param_name: \
|
ASSIGN_TUPLE_PARAM = lambda param_name: \
|
||||||
SyntaxTree('expr', [ Token('LOAD_FAST', pattr=param_name) ])
|
SyntaxTree("expr", [ Token("LOAD_FAST", pattr=param_name) ])
|
||||||
|
|
||||||
escape = re.compile(r'''
|
escape = re.compile(r"""
|
||||||
(?P<prefix> [^%]* )
|
(?P<prefix> [^%]* )
|
||||||
% ( \[ (?P<child> -? \d+ ) \] )?
|
% ( \[ (?P<child> -? \d+ ) \] )?
|
||||||
((?P<type> [^{] ) |
|
((?P<type> [^{] ) |
|
||||||
( [{] (?P<expr> [^}]* ) [}] ))
|
( [{] (?P<expr> [^}]* ) [}] ))
|
||||||
''', re.VERBOSE)
|
""", re.VERBOSE)
|
||||||
|
Reference in New Issue
Block a user