Skip to content

Commit 52b0f1f

Browse files
author
rocky
committed
Handle Graal lineoffsets better
1 parent 9c989ac commit 52b0f1f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

xdis/lineoffsets.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from xdis.codetype.base import iscode
1515
from xdis.load import check_object_path, load_module
1616
from xdis.op_imports import get_opcode_module
17+
from xdis.version_info import PythonImplementation
1718

1819
# Information about a single line in a particular piece of code
1920
# Note that a code can have several lines with the same value but
@@ -51,7 +52,14 @@ def _populate_lines(self) -> None:
5152
code = self.code
5253
code_map = {code.co_name: code}
5354
last_line_info = None
54-
for instr in get_instructions_bytes(
55+
if self.opc.python_implementation == PythonImplementation.Graal:
56+
from xdis.bytecode_graal import get_instructions_bytes_graal
57+
58+
get_instructions_fn = get_instructions_bytes_graal
59+
else:
60+
get_instructions_fn = get_instructions_bytes
61+
62+
for instr in get_instructions_fn(
5563
code_object=code,
5664
opc=self.opc,
5765
):

0 commit comments

Comments
 (0)