diff --git a/uncompyle6/parsers/parse35.py b/uncompyle6/parsers/parse35.py index 63e458e0..c1119b6a 100644 --- a/uncompyle6/parsers/parse35.py +++ b/uncompyle6/parsers/parse35.py @@ -35,13 +35,13 @@ class Python35Parser(Python34Parser): # Python 3.5+ does jump optimization # In <.3.5 the below is a JUMP_FORWARD to a JUMP_ABSOLUTE. - # in return_stmt, we will need the semantic actions in pysource.py - # to work out whether to dedent or not based on the presence of - # RETURN_END_IF vs RETURN_VALUE + + return_if_stmt ::= ret_expr RETURN_END_IF POP_BLOCK ifelsestmtc ::= testexpr c_stmts_opt JUMP_FORWARD else_suitec # ifstmt ::= testexpr c_stmts_opt + # Python 3.3+ also has yield from. 3.5 does it # differently than 3.3, 3.4 diff --git a/uncompyle6/scanners/scanner3.py b/uncompyle6/scanners/scanner3.py index b3100c2c..164afd16 100644 --- a/uncompyle6/scanners/scanner3.py +++ b/uncompyle6/scanners/scanner3.py @@ -624,9 +624,13 @@ class Scanner3(Scanner): self.fixed_jumps[offset] = end (line_no, next_line_byte) = self.lines[offset] jump_back = self.last_instr(start, end, self.opc.JUMP_ABSOLUTE, - next_line_byte, False) + next_line_byte, False) + + if jump_back: + jump_forward_offset = jump_back+3 + else: + jump_forward_offset = None - jump_forward_offset = jump_back+3 return_val_offset1 = self.prev[self.prev[end]] if (jump_back and jump_back != self.prev_op[end]