Skip to content

Commit 7787166

Browse files
committedJul 13, 2024
Add grammar rule involving RETURN_END_IF
1 parent e357946 commit 7787166

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed
 

‎test/bytecode_3.5/02_for_else_bug.pyc

301 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Adapted 3.5 from _bootstrap_external.py
2+
3+
4+
def spec_from_file_location(loader, location):
5+
if loader:
6+
for _ in __file__:
7+
if location:
8+
break
9+
else:
10+
return None

‎uncompyle6/parsers/parse35.py

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ def p_35on(self, args):
111111
return_if_stmt ::= return_expr RETURN_END_IF POP_BLOCK
112112
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
113113
114+
return ::= return_expr RETURN_END_IF
115+
114116
jb_else ::= JUMP_BACK ELSE
115117
ifelsestmtc ::= testexpr c_stmts_opt JUMP_FORWARD else_suitec
116118
ifelsestmtl ::= testexpr c_stmts_opt jb_else else_suitel

‎uncompyle6/semantics/consts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431
"mkfuncdeco": ("%|@%c\n%c", (0, "expr"), 1),
432432
# A custom rule in n_function def distinguishes whether to call this or
433433
# function_def_async
434-
"mkfuncdeco0": ("%|def %c\n", (0, "mkfunc")),
434+
"mkfuncdeco0": ("%|def %c\n", (0, ("mkfunc", "mkfunc_annotate"))),
435435

436436
# In cases where we desire an explict new line.
437437
# After docstrings which are followed by a "def" is

0 commit comments

Comments
 (0)
Failed to load comments.