Author eryksun
Recipients docs@python, eryksun, gaborjbernat, keller00, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
Date 2020-10-19.14:03:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603116221.45.0.672061075784.issue42041@roundup.psfhosted.org>
In-reply-to
Content
> My biggest concern with the suggested wording ... is that it 
> reintroduces the issue with the redirector.

I thought I addressed that in second paragraph by recommending sys.executable. It could be emphasized that running "python[x][.y]" is unreliable, without going into detailed examples of where it's unreliable on various platforms (i.e. avoid going into detail about issues with naming of binaries, embedding, the search path, redirectors, etc). A separate cross-platform note in venv could advise scripts to use sys.executable, with a link to the subprocess.Popen docs and a reference to the note about the platform-dependent search behavior and unreliability of running "python[x][.y]".

If the redirector issue is mentioned anywhere, I think it should be in the venv docs. It can include a note about the Windows implementation detail to use a redirector for non-symlink virtual environments. Of concern to me here is that the process handle and PID returned by CreateProcess is for the redirector. One can't use the returned process handle or PID with DuplicateHandle or WSADuplicateSocket (i.e. socket.socket.share) to share handles and sockets with a script that's running as a child process. It might seem to still be working, purely by accident, because the parent script is executing the base "python" instead of the redirector, but in that case the child script isn't using the virtual environment. There isn't an official way to support running sys._base_executable with the __PYVENV_LAUNCHER__ environment variable, as multiprocessing implements internally. Maybe the workaround should be incorporated implicitly in subprocess.Popen if `executable`, `args`, or args[0] is equal to sys.executable and sys._base_executable is different. If the latter is implemented, and using sys.executable is strongly advised, it strengthens the case to avoid discussing the redirector entirely.
History
Date User Action Args
2020-10-19 14:03:41eryksunsetrecipients: + eryksun, paul.moore, vinay.sajip, tim.golden, docs@python, zach.ware, steve.dower, gaborjbernat, keller00
2020-10-19 14:03:41eryksunsetmessageid: <1603116221.45.0.672061075784.issue42041@roundup.psfhosted.org>
2020-10-19 14:03:41eryksunlinkissue42041 messages
2020-10-19 14:03:40eryksuncreate