Steve Dower <steve.do...@python.org> added the comment:

> We need a way to allow multiprocessing to spawn the real python.exe instead 
> of the launcher executable that's set as sys.executable.

Got to a computer and had just reached the same conclusion.

Given the environment is inherited, it's easy to do:

>>> import _winapi
>>> import multiprocessing.spawn
>>> multiprocessing.spawn.set_executable(_winapi.GetModuleFileName(0))

This may interfere with others who currently override sys.executable when 
hosting Python, since they'll get their override by default. But changing 
sys.executable to _not_ be the venv one will break anyone who doesn't correctly 
inherit environment variables (specifically, __PYVENV_LAUNCHER__, but this is 
deliberately not documented ;) ). 

Perhaps we just change the multiprocessing default on Windows when 
sys.base_prefix != sys.prefix?

----------
assignee:  -> steve.dower

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

Reply via email to