https://github.com/python/cpython/commit/55718cb6eda1a28b4c02b3be97b46944e427418a
commit: 55718cb6eda1a28b4c02b3be97b46944e427418a
branch: main
author: Eduardo Villalpando Mello <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-05-24T12:15:56+05:30
summary:

gh-150244: Fix `test_create_subprocess_env_shell` to handle PATH with spaces 
(#150281)

files:
M Lib/test/test_asyncio/test_subprocess.py

diff --git a/Lib/test/test_asyncio/test_subprocess.py 
b/Lib/test/test_asyncio/test_subprocess.py
index c08eb7cf2615680..4ac6b23b7120fcc 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"

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to