]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Skip test_jit when the JIT backend is "interpreter" (GH-149423)
authorDiego Russo <diego.russo@arm.com>
Wed, 6 May 2026 08:20:33 +0000 (09:20 +0100)
committerGitHub <noreply@github.com>
Wed, 6 May 2026 08:20:33 +0000 (09:20 +0100)
Lib/test/test_gdb/test_jit.py

index ea88d7b0a1fe7595232cb1180656f5c87afeb9e7..7cb604f8aee8c3ec0946acc525e9245c7993c8e9 100644 (file)
@@ -4,9 +4,18 @@ import re
 import sys
 import unittest
 
+from test.support import import_helper
+
 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")
 # In batch GDB, break in builtin_id() while it is running under JIT,
 # 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
 # x86_64 and AArch64 (a #error fires otherwise). Skip cleanly on other
 # platforms or architectures instead of producing timeouts / empty backtraces.
-# is_enabled() implies is_available() and also implies that the runtime has
-# JIT execution active; interpreter-only tier 2 builds don't hit this path.
+# sys._jit.is_enabled() is true for --enable-experimental-jit=interpreter,
+# but these tests need native JIT code and a py::jit:executor frame.
 @unittest.skipUnless(sys.platform == "linux",
                      "GDB JIT interface is only implemented for Linux + ELF")
 @unittest.skipUnless(platform.machine() in ("x86_64", "aarch64"),
                      "GDB JIT CFI emitter only supports x86_64 and AArch64")
-@unittest.skipUnless(hasattr(sys, "_jit") and sys._jit.is_enabled(),
-                     "requires a JIT-enabled build with JIT execution active")
+@unittest.skipUnless(NATIVE_JIT_ENABLED,
+                     "requires native JIT execution active")
 class JitBacktraceTests(DebuggerTests):
     def get_stack_trace(self, **kwargs):
         # These tests validate the JIT-relevant part of the backtrace via