Skip to content

Commit 1e2da45

Browse files
author
rocky
committed
Adjsut for Graal.
1 parent a19055b commit 1e2da45

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

pytest/test_load_file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def get_srcdir() -> str:
1414

1515

1616
@pytest.mark.skipif(
17-
os.name == "nt", reason="Windows differences in output need going over"
17+
os.name == "nt", reason="Windows differences in output need going over."
18+
)
19+
@pytest.mark.skipif(
20+
IS_GRAAL, reason="Graal load_module needs more work."
1821
)
1922
def test_load_file() -> None:
2023
srcdir = get_srcdir()

pytest/test_opcode.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

33
import pytest
44
from xdis import get_opcode
5-
from xdis.version_info import IS_PYPY, PYTHON_IMPLEMENTATION, PYTHON_VERSION_TRIPLE
5+
from xdis.version_info import (
6+
IS_GRAAL,
7+
IS_PYPY,
8+
PYTHON_IMPLEMENTATION,
9+
PYTHON_VERSION_TRIPLE,
10+
)
611

712

813
@pytest.mark.skipif(
914
PYTHON_VERSION_TRIPLE >= (3, 14),
1015
reason="Python >= 3.14 is not complete.",
1116
)
17+
@pytest.mark.skipif(
18+
IS_GRAAL, reason="Graal's `dis' module lies about its opcodes."
19+
)
1220
def test_opcode() -> None:
1321
opc = get_opcode(PYTHON_VERSION_TRIPLE, PYTHON_IMPLEMENTATION)
1422
opmap = dict([(k.replace("+", "_"), v) for (k, v) in dis.opmap.items()])

xdis/magics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,11 @@ def __by_version(magic_versions: Dict[bytes, str]) -> dict:
717717

718718
# 21290 = 21000 + 29 * 10
719719
add_magic_from_int(21290, "3.11.7Graal")
720+
720721
# add_magic_from_int(21290, "3.12.8Graal")
722+
# Paritally compensate for one magic for two Graal Python versions:
723+
version2magicint["3.12.8Graal"].append(21290)
724+
721725

722726

723727
# Jython uses JVM bytecode, not CPython PyPy bytecode.
@@ -936,6 +940,9 @@ def sysinfo2magic(version_info: tuple = tuple(sys.version_info)) -> bytes:
936940
# just not have platform
937941
pass
938942

943+
if vers_str == "3.12.8Graal":
944+
# 3.12.8Graal and 3.11.7Graal have the same magic number!
945+
vers_str = "3.11.7Graal"
939946
return magics.get(vers_str, b"?!\r\n")
940947

941948

0 commit comments

Comments
 (0)