From 8c1b9f422b0149876481b54403eec5426a36af4c Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 5 Mar 2026 11:09:27 +0100 Subject: [PATCH 1/2] gh-145335: Skip Emscripten for os.execve test Emscripten's os.execve always fails with ENOEXEC. --- Lib/test/test_os/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os/test_os.py b/Lib/test/test_os/test_os.py index 3cab8ff9536d23..c18b21551df114 100644 --- a/Lib/test/test_os/test_os.py +++ b/Lib/test/test_os/test_os.py @@ -2824,7 +2824,7 @@ def test_negative_fd_ebadf(self, fd): func(*args) self.assertEqual(ctx.exception.errno, errno.EBADF) - if hasattr(os, "execve") and os.execve in os.supports_fd: + if hasattr(os, "execve") and os.execve in os.supports_fd and not support.is_emscripten: # glibc fails with EINVAL, musl fails with EBADF with self.assertRaises(OSError) as ctx: os.execve(fd, [sys.executable, "-c", "pass"], os.environ) From 4e57790c04a0b59fe9450f10633ce5fdbbd988cb Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 5 Mar 2026 11:18:41 +0100 Subject: [PATCH 2/2] Update Lib/test/test_os/test_os.py Co-authored-by: Victor Stinner --- Lib/test/test_os/test_os.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_os/test_os.py b/Lib/test/test_os/test_os.py index c18b21551df114..06f69caad12bc8 100644 --- a/Lib/test/test_os/test_os.py +++ b/Lib/test/test_os/test_os.py @@ -2824,7 +2824,8 @@ def test_negative_fd_ebadf(self, fd): func(*args) self.assertEqual(ctx.exception.errno, errno.EBADF) - if hasattr(os, "execve") and os.execve in os.supports_fd and not support.is_emscripten: + if (hasattr(os, "execve") and os.execve in os.supports_fd + and support.has_subprocess_support): # glibc fails with EINVAL, musl fails with EBADF with self.assertRaises(OSError) as ctx: os.execve(fd, [sys.executable, "-c", "pass"], os.environ)