You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Python 3.6+ control flow
This commit is contained in:
BIN
test/bytecode_3.6/03_if_try.pyc
Normal file
BIN
test/bytecode_3.6/03_if_try.pyc
Normal file
Binary file not shown.
@@ -42,6 +42,11 @@ class Python36Parser(Python35Parser):
|
|||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt
|
||||||
JUMP_BACK come_froms POP_BLOCK COME_FROM_LOOP
|
JUMP_BACK come_froms POP_BLOCK COME_FROM_LOOP
|
||||||
|
|
||||||
|
# 3.6 due to jump optimization, we sometimes add RETURN_END_IF where
|
||||||
|
# RETURN_VALUE is meant. Specifcally this can happen in
|
||||||
|
# ifelsestmt -> ...else_suite _. suite_stmts... (last) stmt
|
||||||
|
return ::= ret_expr RETURN_END_IF
|
||||||
|
|
||||||
# A COME_FROM is dropped off because of JUMP-to-JUMP optimization
|
# A COME_FROM is dropped off because of JUMP-to-JUMP optimization
|
||||||
and ::= expr jmp_false expr
|
and ::= expr jmp_false expr
|
||||||
and ::= expr jmp_false expr jmp_false
|
and ::= expr jmp_false expr jmp_false
|
||||||
|
@@ -957,8 +957,6 @@ class Scanner3(Scanner):
|
|||||||
elif op == self.opc.POP_EXCEPT:
|
elif op == self.opc.POP_EXCEPT:
|
||||||
next_offset = xdis.next_offset(op, self.opc, offset)
|
next_offset = xdis.next_offset(op, self.opc, offset)
|
||||||
target = self.get_target(next_offset)
|
target = self.get_target(next_offset)
|
||||||
if target is None:
|
|
||||||
from trepan.api import debug; debug()
|
|
||||||
if target > next_offset:
|
if target > next_offset:
|
||||||
next_op = code[next_offset]
|
next_op = code[next_offset]
|
||||||
if (self.opc.JUMP_ABSOLUTE == next_op and
|
if (self.opc.JUMP_ABSOLUTE == next_op and
|
||||||
@@ -986,8 +984,9 @@ class Scanner3(Scanner):
|
|||||||
# In RETURN_VALUE, JUMP_ABSOLUTE, RETURN_VALUE is never RETURN_END_IF
|
# In RETURN_VALUE, JUMP_ABSOLUTE, RETURN_VALUE is never RETURN_END_IF
|
||||||
if op == self.opc.RETURN_VALUE:
|
if op == self.opc.RETURN_VALUE:
|
||||||
next_offset = xdis.next_offset(op, self.opc, offset)
|
next_offset = xdis.next_offset(op, self.opc, offset)
|
||||||
if (next_offset < len(code) and code[next_offset] == self.opc.JUMP_ABSOLUTE and
|
if ( next_offset < len(code) and
|
||||||
offset in self.return_end_ifs):
|
(code[next_offset] == self.opc.JUMP_ABSOLUTE and
|
||||||
|
offset in self.return_end_ifs) ):
|
||||||
self.return_end_ifs.remove(offset)
|
self.return_end_ifs.remove(offset)
|
||||||
pass
|
pass
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user