Skip to content

Commit 1b42680

Browse files
[3.14] gh-157983: Skip test for ctypes.util.find_library when ld is mold (GH-157984) (#158009)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent dbcae90 commit 1b42680

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎Lib/test/test_ctypes/test_find.py‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os.path
2+
import subprocess
23
import sys
34
import test.support
45
import unittest
@@ -78,9 +79,28 @@ def test_shell_injection(self):
7879
@unittest.skipUnless(sys.platform.startswith('linux'),
7980
'Test only valid for Linux')
8081
class FindLibraryLinux(unittest.TestCase):
82+
@classmethod
83+
def setUpClass(cls):
84+
try:
85+
p = subprocess.run(['ld', '--version'],
86+
stdout=subprocess.PIPE,
87+
stderr=subprocess.DEVNULL,
88+
text=True)
89+
except OSError:
90+
pass
91+
else:
92+
if p.stdout.startswith('mold '):
93+
# The mold linker is known to be incompatible with
94+
# ctypes.util.find_library. The function is
95+
# documented as "Try to find a library..."
96+
# and formally soft-deprecated in 3.15+. We
97+
# we skip the test rather than try to fix it
98+
# (which would risk breaking other unsupported
99+
# platforms).
100+
raise unittest.SkipTest('Fails when ld is mold')
101+
81102
@thread_unsafe('uses setenv')
82103
def test_find_on_libpath(self):
83-
import subprocess
84104
import tempfile
85105

86106
try:

0 commit comments

Comments
 (0)