mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-10-07 10:13:39 +00:00
Move refactored find-jump-targets from 3.6 to 3.x
This commit is contained in:
parent
124267849c
commit
4a904951f4
2
Makefile
2
Makefile
@ -44,7 +44,7 @@ check-2.6:
|
||||
|
||||
#:PyPy 2.6.1 PyPy 5.0.1, or PyPy 5.8.0-beta0
|
||||
# Skip for now
|
||||
2.6 5.0 5.3 5.8:
|
||||
2.6 5.0 5.3 5.6 5.8:
|
||||
|
||||
#:PyPy pypy3-2.4.0 Python 3:
|
||||
pypy-3.2 2.4:
|
||||
|
@ -487,26 +487,17 @@ class Scanner3(Scanner):
|
||||
self.setup_loops = {} # setup_loop offset given target
|
||||
|
||||
targets = {}
|
||||
extended_arg = 0
|
||||
for offset in self.op_range(0, n):
|
||||
op = code[offset]
|
||||
|
||||
if op == self.opc.EXTENDED_ARG:
|
||||
arg = code2num(code, offset+1) | extended_arg
|
||||
extended_arg = self.extended_arg_val(arg)
|
||||
continue
|
||||
for i, inst in enumerate(self.insts):
|
||||
offset = inst.offset
|
||||
op = inst.opcode
|
||||
|
||||
# Determine structures and fix jumps in Python versions
|
||||
# since 2.3
|
||||
self.detect_control_flow(offset, targets, extended_arg)
|
||||
self.detect_control_flow(offset, targets, 0)
|
||||
|
||||
has_arg = (op >= op3.HAVE_ARGUMENT)
|
||||
if has_arg:
|
||||
if inst.has_arg:
|
||||
label = self.fixed_jumps.get(offset)
|
||||
if self.version >= 3.6:
|
||||
oparg = code[offset+1]
|
||||
else:
|
||||
oparg = code[offset+1] + code[offset+2] * 256
|
||||
oparg = inst.arg
|
||||
next_offset = xdis.next_offset(op, self.opc, offset)
|
||||
|
||||
if label is None:
|
||||
@ -524,7 +515,6 @@ class Scanner3(Scanner):
|
||||
targets[label] = targets.get(label, []) + [offset]
|
||||
pass
|
||||
|
||||
extended_arg = 0
|
||||
pass # for loop
|
||||
|
||||
# DEBUG:
|
||||
|
@ -75,12 +75,11 @@ class Scanner36(Scanner3):
|
||||
self.setup_loops = {} # setup_loop offset given target
|
||||
|
||||
targets = {}
|
||||
extended_arg = 0
|
||||
for i, inst in enumerate(self.insts):
|
||||
offset = inst.offset
|
||||
op = inst.opcode
|
||||
|
||||
self.detect_control_flow(offset, targets, extended_arg)
|
||||
self.detect_control_flow(offset, targets, 0)
|
||||
|
||||
if inst.has_arg:
|
||||
label = self.fixed_jumps.get(offset)
|
||||
@ -102,7 +101,6 @@ class Scanner36(Scanner3):
|
||||
targets[label] = targets.get(label, []) + [offset]
|
||||
pass
|
||||
|
||||
extended_arg = 0
|
||||
pass # for loop
|
||||
|
||||
# DEBUG:
|
||||
|
Loading…
Reference in New Issue
Block a user