You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 16:59:52 +08:00
Track change in xdis Instruction ...
we now need to set positions which will be used in newer Pythons.
This commit is contained in:
@@ -293,20 +293,21 @@ class Scanner37Base(Scanner):
|
|||||||
# but the operator and operand properties come from the other
|
# but the operator and operand properties come from the other
|
||||||
# instruction
|
# instruction
|
||||||
self.insts[i] = Instruction(
|
self.insts[i] = Instruction(
|
||||||
jump_inst.opname,
|
opcode=jump_inst.opcode,
|
||||||
jump_inst.opcode,
|
opname=jump_inst.opname,
|
||||||
jump_inst.optype,
|
arg=jump_inst.arg,
|
||||||
jump_inst.inst_size,
|
argval=jump_inst.argval,
|
||||||
jump_inst.arg,
|
argrepr=jump_inst.argrepr,
|
||||||
jump_inst.argval,
|
offset=inst.offset,
|
||||||
jump_inst.argrepr,
|
starts_line=inst.starts_line,
|
||||||
jump_inst.has_arg,
|
is_jump_target=inst.is_jump_target,
|
||||||
inst.offset,
|
positions=None,
|
||||||
inst.starts_line,
|
optype=jump_inst.optype,
|
||||||
inst.is_jump_target,
|
has_arg=jump_inst.has_arg,
|
||||||
inst.has_extended_arg,
|
inst_size=jump_inst.inst_size,
|
||||||
None,
|
has_extended_arg=inst.has_extended_arg,
|
||||||
None,
|
tos_str=None,
|
||||||
|
start_offset=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Get jump targets
|
# Get jump targets
|
||||||
@@ -939,7 +940,7 @@ class Scanner37Base(Scanner):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from xdis.version_info import PYTHON_VERSION_TRIPLE, version_tuple_to_str
|
from xdis.version_info import PYTHON_VERSION_TRIPLE, version_tuple_to_str
|
||||||
|
|
||||||
if PYTHON_VERSION_TRIPLE[:2] == (3, 7):
|
if (3, 7) <= PYTHON_VERSION_TRIPLE[:2] < (3, 9):
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
co = inspect.currentframe().f_code # type: ignore
|
co = inspect.currentframe().f_code # type: ignore
|
||||||
@@ -948,5 +949,8 @@ if __name__ == "__main__":
|
|||||||
for t in tokens:
|
for t in tokens:
|
||||||
print(t)
|
print(t)
|
||||||
else:
|
else:
|
||||||
print(f"Need to be Python 3.7 to demo; I am version {version_tuple_to_str()}.")
|
print(
|
||||||
|
"Need to be Python 3.7..3.8 to demo; "
|
||||||
|
f"I am version {version_tuple_to_str()}."
|
||||||
|
)
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user