Eryk Sun <eryk...@gmail.com> added the comment:

I checked the source code in PC/launcher.c process(). It turns out that 
`executable` is not getting quoted in the venv launcher case.

CreateProcessW() tries to get around this. If the command isn't quoted, it has 
a loop that consumes up to a space (or tab) and checks for an existing file 
(not a directory). If it finds a file, it rewrites the command line to quote 
the path of the file.

My test happened to work. But it's simple enough to create an example that 
fails. For example, as an elevated admin, create a file named "C:\Program". Now 
the venv launcher won't be able to execute a base interpreter that's installed 
in "C:\Program Files":

    C:\Temp>echo >C:\Program
    
    C:\Temp>"C:\Program Files\Python310\python.exe" -m venv env
    Error: Command '['C:\\Temp\\env\\Scripts\\python.exe', '-Im', 
    'ensurepip', '--upgrade', '--default-pip']' returned non-zero 
    exit status 101.

----------
priority: normal -> critical
stage:  -> needs patch
versions: +Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46686>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to