Skip to content

Commit 66d0897

Browse files
hugovkmiss-islingtonencukou
authored
[3.13] gh-157983: Skip test for ctypes.util.find_library when ld is mold (GH-157984) (GH-158064)
(cherry picked from commit 1b42680) Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 2fa3dcb commit 66d0897

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,8 +79,27 @@ 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
def test_find_on_libpath(self):
82-
import subprocess
83103
import tempfile
84104

85105
try:

0 commit comments

Comments
 (0)