Skip to content

Commit 1ef631d

Browse files
committed
Track change in xdis Instruction ...
we now need to set positions which will be used in newer Pythons.
1 parent 3e00880 commit 1ef631d

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

uncompyle6/scanners/scanner37base.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,21 @@ def tokens_append(j, token):
293293
# but the operator and operand properties come from the other
294294
# instruction
295295
self.insts[i] = Instruction(
296-
jump_inst.opname,
297-
jump_inst.opcode,
298-
jump_inst.optype,
299-
jump_inst.inst_size,
300-
jump_inst.arg,
301-
jump_inst.argval,
302-
jump_inst.argrepr,
303-
jump_inst.has_arg,
304-
inst.offset,
305-
inst.starts_line,
306-
inst.is_jump_target,
307-
inst.has_extended_arg,
308-
None,
309-
None,
296+
opcode=jump_inst.opcode,
297+
opname=jump_inst.opname,
298+
arg=jump_inst.arg,
299+
argval=jump_inst.argval,
300+
argrepr=jump_inst.argrepr,
301+
offset=inst.offset,
302+
starts_line=inst.starts_line,
303+
is_jump_target=inst.is_jump_target,
304+
positions=None,
305+
optype=jump_inst.optype,
306+
has_arg=jump_inst.has_arg,
307+
inst_size=jump_inst.inst_size,
308+
has_extended_arg=inst.has_extended_arg,
309+
tos_str=None,
310+
start_offset=None,
310311
)
311312

312313
# Get jump targets
@@ -939,7 +940,7 @@ def next_except_jump(self, start):
939940
if __name__ == "__main__":
940941
from xdis.version_info import PYTHON_VERSION_TRIPLE, version_tuple_to_str
941942

942-
if PYTHON_VERSION_TRIPLE[:2] == (3, 7):
943+
if (3, 7) <= PYTHON_VERSION_TRIPLE[:2] < (3, 9):
943944
import inspect
944945

945946
co = inspect.currentframe().f_code # type: ignore
@@ -948,5 +949,8 @@ def next_except_jump(self, start):
948949
for t in tokens:
949950
print(t)
950951
else:
951-
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str()}.")
952+
print(
953+
"Need to be Python 3.7..3.8 to demo; "
954+
f"I am version {version_tuple_to_str()}."
955+
)
952956
pass

0 commit comments

Comments
 (0)