]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-126554: correct detection of `gcc` for `TestNullDlsym.test_null_dlsym`...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 10 Feb 2025 10:16:28 +0000 (11:16 +0100)
committerGitHub <noreply@github.com>
Mon, 10 Feb 2025 10:16:28 +0000 (10:16 +0000)
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.
(cherry picked from commit 978211c8a8646b050a8d687ca720f934fcce112c)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Co-authored-by: Peter Marko <peter.marko@siemens.com>
Lib/test/test_ctypes/test_dlerror.py

index 6bf492399cbf95c97e0763f3ff4579f8dafaea00..1c1b2aab3d589eabe02bf5e38bf92bc7207ae6ce 100644 (file)
@@ -58,11 +58,14 @@ class TestNullDlsym(unittest.TestCase):
         import subprocess
         import tempfile
 
-        retcode = subprocess.call(["gcc", "--version"],
-                                  stdout=subprocess.DEVNULL,
-                                  stderr=subprocess.DEVNULL)
-        if retcode != 0:
+        try:
+            retcode = subprocess.call(["gcc", "--version"],
+                                      stdout=subprocess.DEVNULL,
+                                      stderr=subprocess.DEVNULL)
+        except OSError:
             self.skipTest("gcc is missing")
+        if retcode != 0:
+            self.skipTest("gcc --version failed")
 
         pipe_r, pipe_w = os.pipe()
         self.addCleanup(os.close, pipe_r)