Skip test_jit when the JIT backend is "interpreter" (GH-149423)

This commit is contained in:
Diego Russo
2026-05-06 09:20:33 +01:00
committed by GitHub
parent 970b0433f4
commit 055cbf04ab
+13 -4
View File
@@ -4,9 +4,18 @@ import re
import sys import sys
import unittest import unittest
from test.support import import_helper
from .util import setup_module, DebuggerTests from .util import setup_module, DebuggerTests
_testinternalcapi = import_helper.import_module("_testinternalcapi")
NATIVE_JIT_ENABLED = (
hasattr(sys, "_jit")
and sys._jit.is_enabled()
and _testinternalcapi.get_jit_backend() == "jit"
)
JIT_SAMPLE_SCRIPT = os.path.join(os.path.dirname(__file__), "gdb_jit_sample.py") JIT_SAMPLE_SCRIPT = os.path.join(os.path.dirname(__file__), "gdb_jit_sample.py")
# In batch GDB, break in builtin_id() while it is running under JIT, # In batch GDB, break in builtin_id() while it is running under JIT,
# then repeatedly "finish" until the selected frame is the JIT executor. # then repeatedly "finish" until the selected frame is the JIT executor.
@@ -62,14 +71,14 @@ def setUpModule():
# Python/jit_unwind.c, and the synthetic EH-frame is only implemented for # Python/jit_unwind.c, and the synthetic EH-frame is only implemented for
# x86_64 and AArch64 (a #error fires otherwise). Skip cleanly on other # x86_64 and AArch64 (a #error fires otherwise). Skip cleanly on other
# platforms or architectures instead of producing timeouts / empty backtraces. # platforms or architectures instead of producing timeouts / empty backtraces.
# is_enabled() implies is_available() and also implies that the runtime has # sys._jit.is_enabled() is true for --enable-experimental-jit=interpreter,
# JIT execution active; interpreter-only tier 2 builds don't hit this path. # but these tests need native JIT code and a py::jit:executor frame.
@unittest.skipUnless(sys.platform == "linux", @unittest.skipUnless(sys.platform == "linux",
"GDB JIT interface is only implemented for Linux + ELF") "GDB JIT interface is only implemented for Linux + ELF")
@unittest.skipUnless(platform.machine() in ("x86_64", "aarch64"), @unittest.skipUnless(platform.machine() in ("x86_64", "aarch64"),
"GDB JIT CFI emitter only supports x86_64 and AArch64") "GDB JIT CFI emitter only supports x86_64 and AArch64")
@unittest.skipUnless(hasattr(sys, "_jit") and sys._jit.is_enabled(), @unittest.skipUnless(NATIVE_JIT_ENABLED,
"requires a JIT-enabled build with JIT execution active") "requires native JIT execution active")
class JitBacktraceTests(DebuggerTests): class JitBacktraceTests(DebuggerTests):
def get_stack_trace(self, **kwargs): def get_stack_trace(self, **kwargs):
# These tests validate the JIT-relevant part of the backtrace via # These tests validate the JIT-relevant part of the backtrace via