You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
DRY scanner code more...
Expand 2.6 testing
This commit is contained in:
@@ -105,6 +105,11 @@ class Scanner(object):
|
||||
bytecode = Bytecode(co, self.opc)
|
||||
self.build_prev_op()
|
||||
self.insts = self.remove_extended_args(list(bytecode))
|
||||
self.lines = self.build_lines_data(co)
|
||||
self.offset2inst_index = {}
|
||||
for i, inst in enumerate(self.insts):
|
||||
self.offset2inst_index[inst.offset] = i
|
||||
|
||||
return bytecode
|
||||
|
||||
def build_lines_data(self, code_obj):
|
||||
@@ -117,10 +122,6 @@ class Scanner(object):
|
||||
linestarts = list(self.opc.findlinestarts(code_obj))
|
||||
self.linestarts = dict(linestarts)
|
||||
|
||||
# Plain set with offsets of first ops on line.
|
||||
# FIXME: we probably could do without
|
||||
self.linestart_offsets = set(a for (a, _) in linestarts)
|
||||
|
||||
# 'List-map' which shows line number of current op and offset of
|
||||
# first op on following line, given offset of op as index
|
||||
lines = []
|
||||
@@ -452,6 +453,9 @@ class Scanner(object):
|
||||
Go through passed offsets, filtering ifs
|
||||
located somewhere mid-line.
|
||||
"""
|
||||
|
||||
# FIXME: this doesn't work for Python 3.6+
|
||||
|
||||
filtered = []
|
||||
for i in ifs:
|
||||
# For each offset, if line number of current and next op
|
||||
|
Reference in New Issue
Block a user