]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-145557: Check ctypes is available in test_external_inspection (#145558)
authorAlex Malyshev <lex.malyshev@gmail.com>
Thu, 5 Mar 2026 19:03:30 +0000 (14:03 -0500)
committerGitHub <noreply@github.com>
Thu, 5 Mar 2026 19:03:30 +0000 (19:03 +0000)
Currently TestGetStackTrace.test_self_trace_after_ctypes_import() will fail if
the _ctypes extension is not built.  Make it match test_ctypes by skipping
the test in that case.

Lib/test/test_external_inspection.py

index 890aa584cd192ca5bcd2e110c2f18699b9846596..ec7192b1b89184cec41fefde189ebffb617e0f5c 100644 (file)
@@ -17,6 +17,7 @@ from test.support import (
     requires_gil_enabled,
     requires_remote_subprocess_debugging,
 )
+from test.support.import_helper import import_module
 from test.support.script_helper import make_script
 from test.support.socket_helper import find_unused_port
 
@@ -529,6 +530,10 @@ class TestGetStackTrace(RemoteInspectionTestBase):
         The remote debugging code must skip these uninitialized duplicate
         mappings and find the real PyRuntime. See gh-144563.
         """
+
+        # Skip the test if the _ctypes module is missing.
+        import_module("_ctypes")
+
         # Run the test in a subprocess to avoid side effects
         script = textwrap.dedent("""\
             import os