You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Some Python 3.6 bytecode->wordcode fixes
This commit is contained in:
@@ -228,7 +228,7 @@ class Scanner(object):
|
|||||||
if op < self.opc.HAVE_ARGUMENT:
|
if op < self.opc.HAVE_ARGUMENT:
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 3
|
return 2 if self.version >= 3.6 else 3
|
||||||
|
|
||||||
def remove_mid_line_ifs(self, ifs):
|
def remove_mid_line_ifs(self, ifs):
|
||||||
"""
|
"""
|
||||||
|
@@ -562,9 +562,15 @@ class Scanner3(Scanner):
|
|||||||
Get target offset for op located at given <offset>.
|
Get target offset for op located at given <offset>.
|
||||||
"""
|
"""
|
||||||
op = self.code[offset]
|
op = self.code[offset]
|
||||||
target = self.code[offset+1] + self.code[offset+2] * 256
|
if self.version >= 3.6:
|
||||||
if op in op3.hasjrel:
|
target = self.code[offset+1]
|
||||||
target += offset + 3
|
if op in op3.hasjrel:
|
||||||
|
target += offset + 2
|
||||||
|
else:
|
||||||
|
target = self.code[offset+1] + self.code[offset+2] * 256
|
||||||
|
if op in op3.hasjrel:
|
||||||
|
target += offset + 3
|
||||||
|
|
||||||
return target
|
return target
|
||||||
|
|
||||||
def detect_structure(self, offset, targets):
|
def detect_structure(self, offset, targets):
|
||||||
@@ -678,6 +684,11 @@ class Scanner3(Scanner):
|
|||||||
# rocky: if we have a conditional jump to the next instruction, then
|
# rocky: if we have a conditional jump to the next instruction, then
|
||||||
# possibly I am "skipping over" a "pass" or null statement.
|
# possibly I am "skipping over" a "pass" or null statement.
|
||||||
|
|
||||||
|
try:
|
||||||
|
code[prev_op[target]]
|
||||||
|
except:
|
||||||
|
from trepan.api import debug; debug()
|
||||||
|
|
||||||
if ((code[prev_op[target]] in self.pop_jump_if_pop) and
|
if ((code[prev_op[target]] in self.pop_jump_if_pop) and
|
||||||
(target > offset) and prev_op[target] != offset):
|
(target > offset) and prev_op[target] != offset):
|
||||||
self.fixed_jumps[offset] = prev_op[target]
|
self.fixed_jumps[offset] = prev_op[target]
|
||||||
|
Reference in New Issue
Block a user