Improve Python 3.2 decompilation ...

by removing a lot of the control-flow labels of 3.3+
This commit is contained in:
rocky
2017-05-05 21:34:21 -04:00
parent d1c0413b79
commit 4e9555a7f6
2 changed files with 5 additions and 0 deletions

View File

@@ -20,6 +20,9 @@ class Python32Parser(Python3Parser):
whileTruestmt ::= SETUP_LOOP return_stmts
COME_FROM_LOOP
try_middle ::= JUMP_FORWARD COME_FROM_EXCEPT except_stmts
END_FINALLY
# Python 3.2+ has more loop optimization that removes
# JUMP_FORWARD in some cases, and hence we also don't
# see COME_FROM

View File

@@ -225,6 +225,8 @@ class Scanner3(Scanner):
pass
elif inst.offset in self.except_targets:
come_from_name = 'COME_FROM_EXCEPT_CLAUSE'
if self.version <= 3.2:
continue
pass
tokens.append(Token(come_from_name,
None, repr(jump_offset),