From: Eduardo Villalpando Mello Date: Sun, 24 May 2026 06:45:56 +0000 (-0700) Subject: gh-150244: Fix `test_create_subprocess_env_shell` to handle PATH with spaces (#150281) X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=55718cb6eda1a28b4c02b3be97b46944e427418a;p=thirdparty%2FPython%2Fcpython.git gh-150244: Fix `test_create_subprocess_env_shell` to handle PATH with spaces (#150281) --- diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index c08eb7cf2615..4ac6b23b7120 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 @@ class SubprocessMixin: 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"