Skip to content

Commit 8522f91

Browse files
committed
Revise for newer xdis PythonImplementation
1 parent 38c23a1 commit 8522f91

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

trepan/__main__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import tempfile
2424

2525
import pyficache
26-
from xdis import IS_PYPY, PYTHON_VERSION_TRIPLE, load_module
26+
from xdis import PYTHON_IMPLEMENTATION, PYTHON_VERSION_TRIPLE, load_module
2727
from xdis.disasm import disassemble_file
2828
from xdis.version_info import version_tuple_to_str
2929

@@ -95,7 +95,6 @@ def main(dbg=None, sys_argv=list(sys.argv)):
9595
elif not is_readable:
9696
print(f"{__title__}: Can't read Python script file '{mainpyfile}.'")
9797
sys.exit(1)
98-
return
9998

10099
if is_compiled_py(mainpyfile):
101100
try:
@@ -104,24 +103,21 @@ def main(dbg=None, sys_argv=list(sys.argv)):
104103
_,
105104
_,
106105
co,
107-
is_pypy,
106+
python_implementation,
108107
_,
109108
_,
110109
_,
111110
) = load_module(mainpyfile, code_objects=None, fast_load=False)
112-
if is_pypy != IS_PYPY:
113-
bytecode_pypy = "" if is_pypy else "not "
114-
running_pypy = "" if IS_PYPY else "not "
111+
if python_implementation != PYTHON_IMPLEMENTATION:
115112
print(
116-
f"Bytecode is for Version {version_tuple_to_str(end=2)} {bytecode_pypy}running PyPY, but we are {running_pypy}running PyPy."
113+
f"Bytecode is for Version {version_tuple_to_str(end=2)} {python_implementation}, but we are {PYTHON_IMPLEMENTATION}."
117114
)
118115
print("For a cross-version debugger, use trepan-xpy with x-python.")
119116
sys.exit(2)
120117
if python_version[:2] != PYTHON_VERSION_TRIPLE[:2]:
121-
bytecode_pypy = " PyPy" if is_pypy else ""
122118
print(
123-
f"Bytecode is for version {version_tuple_to_str(python_version, end=2)}{bytecode_pypy}, but we are "
124-
f"version {version_tuple_to_str(end=2)}{bytecode_pypy}."
119+
f"Bytecode is for version {version_tuple_to_str(python_version, end=2)}, but we are "
120+
f"version {version_tuple_to_str(end=2)}."
125121
)
126122
print(
127123
"For a cross-version debugger, trepan-xpy with x-python might work."

0 commit comments

Comments
 (0)