From 8affd1e222e7746968743028dcd7a74375184c6f Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Fri, 22 May 2026 16:55:57 -0700 Subject: [PATCH 1/3] gh-150244: Fix `test_create_subprocess_env_shell` to handle cpython path containing spaces On non-win32 systems, the path to the executable was not quoted, causing issues when building the command if it contains spaces, causing the test to fail. --- Lib/test/test_asyncio/test_subprocess.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index c08eb7cf261568..4ac6b23b7120fc 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -1,4 +1,5 @@ import os +import shlex import signal import sys import textwrap @@ -770,9 +771,7 @@ async def check_stdout_output(self, coro, output): def test_create_subprocess_env_shell(self) -> None: async def main() -> None: - executable = sys.executable - if sys.platform == "win32": - executable = f'"{executable}"' + executable = f'"{sys.executable}"' if sys.platform == "win32" else shlex.quote(sys.executable) cmd = f'''{executable} -c "import os, sys; sys.stdout.write(os.getenv('FOO'))"''' env = os.environ.copy() env["FOO"] = "bar" From ada4787dd2ac884f99b5cbc5897cf468983b4e49 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 02:42:46 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst diff --git a/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst b/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst new file mode 100644 index 00000000000000..0cfdf176a9ba84 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst @@ -0,0 +1 @@ +Fix ``test_create_subprocess_env_shell`` to properly quote the executable path on both Win32 and UNIX-like systems to properly handle spaces in the path. From c827eea40b0860be07b5bd427a213798b0a1a96d Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Sat, 23 May 2026 16:16:19 -0700 Subject: [PATCH 3/3] Removed news --- .../next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst diff --git a/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst b/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst deleted file mode 100644 index 0cfdf176a9ba84..00000000000000 --- a/Misc/NEWS.d/next/Tests/2026-05-23-02-42-45.gh-issue-150244.J9yP1-.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``test_create_subprocess_env_shell`` to properly quote the executable path on both Win32 and UNIX-like systems to properly handle spaces in the path.