https://github.com/python/cpython/commit/da0b9b965dc321e4d42c91d8fbaf0cb602f85ed1
commit: da0b9b965dc321e4d42c91d8fbaf0cb602f85ed1
branch: 3.12
author: Hugo van Kemenade <[email protected]>
committer: encukou <[email protected]>
date: 2026-09-24T13:52:29+02:00
summary:

[3.12] gh-157983: Skip test for ctypes.util.find_library when ld is mold 
(GH-157984) (GH-158065)

(cherry picked from commit 1b42680b3a370e8466d3b8ea17ca598e98066b88)

Co-authored-by: Petr Viktorin <[email protected]>

files:
M Lib/test/test_ctypes/test_find.py

diff --git a/Lib/test/test_ctypes/test_find.py 
b/Lib/test/test_ctypes/test_find.py
index a41e94971dfbab0..f795fe4e52a7207 100644
--- a/Lib/test/test_ctypes/test_find.py
+++ b/Lib/test/test_ctypes/test_find.py
@@ -1,6 +1,7 @@
 import unittest
 import unittest.mock
 import os.path
+import subprocess
 import sys
 import test.support
 from test.support import os_helper
@@ -75,8 +76,27 @@ def test_shell_injection(self):
 @unittest.skipUnless(sys.platform.startswith('linux'),
                      'Test only valid for Linux')
 class FindLibraryLinux(unittest.TestCase):
+    @classmethod
+    def setUpClass(cls):
+        try:
+            p = subprocess.run(['ld', '--version'],
+                               stdout=subprocess.PIPE,
+                               stderr=subprocess.DEVNULL,
+                               text=True)
+        except OSError:
+            pass
+        else:
+            if p.stdout.startswith('mold '):
+                # The mold linker is known to be incompatible with
+                # ctypes.util.find_library. The function is
+                # documented as "Try to find a library..."
+                # and formally soft-deprecated in 3.15+. We
+                # we skip the test rather than try to fix it
+                # (which would risk breaking other unsupported
+                # platforms).
+                raise unittest.SkipTest('Fails when ld is mold')
+
     def test_find_on_libpath(self):
-        import subprocess
         import tempfile
 
         try:

_______________________________________________
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