https://github.com/python/cpython/commit/635426f9b529c0f0c3070c8232bf12e392f983d7
commit: 635426f9b529c0f0c3070c8232bf12e392f983d7
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-03-05T19:31:06Z
summary:

[3.14] gh-145557: Check ctypes is available in test_external_inspection 
(GH-145558) (#145565)

gh-145557: Check ctypes is available in test_external_inspection (GH-145558)

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.
(cherry picked from commit 7232883adfc28f94a62d2e79c897db59711702d7)

Co-authored-by: Alex Malyshev <[email protected]>

files:
M Lib/test/test_external_inspection.py

diff --git a/Lib/test/test_external_inspection.py 
b/Lib/test/test_external_inspection.py
index dddb3839af4f07..08779bdb008139 100644
--- a/Lib/test/test_external_inspection.py
+++ b/Lib/test/test_external_inspection.py
@@ -14,6 +14,7 @@
     busy_retry,
     requires_gil_enabled,
 )
+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
 
@@ -163,6 +164,10 @@ def test_self_trace_after_ctypes_import(self):
         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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to