Skip to content

Commit 978211c

Browse files
authored
gh-126554: correct detection of gcc for TestNullDlsym.test_null_dlsym (GH-129872)
In case gcc is not available, the test will fail with FileNotFoundError. So catch the exception to skip the test correctly. Signed-off-by: Peter Marko <[email protected]>
1 parent bff4bfe commit 978211c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_ctypes/test_dlerror.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ def test_null_dlsym(self):
5858
import subprocess
5959
import tempfile
6060

61-
retcode = subprocess.call(["gcc", "--version"],
62-
stdout=subprocess.DEVNULL,
63-
stderr=subprocess.DEVNULL)
64-
if retcode != 0:
61+
try:
62+
retcode = subprocess.call(["gcc", "--version"],
63+
stdout=subprocess.DEVNULL,
64+
stderr=subprocess.DEVNULL)
65+
except OSError:
6566
self.skipTest("gcc is missing")
67+
if retcode != 0:
68+
self.skipTest("gcc --version failed")
6669

6770
pipe_r, pipe_w = os.pipe()
6871
self.addCleanup(os.close, pipe_r)

0 commit comments

Comments
 (0)