This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients chrullrich, davin, eryksun, ned.deily, paul.moore, pitrou, steve.dower, tim.golden, zach.ware
Date 2019-01-21.20:06:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548101165.38.0.889622149708.issue35797@roundup.psfhosted.org>
In-reply-to
Content
multiprocessing could be redesigned to make the child process responsible for duplicating all handles from its logical parent (by PID passed on the command line -- regardless of whatever its real parent is). That avoids the problem of the parent mistakenly duplicating handles to a launcher child process that has no idea that the parent has done this and certainly doesn't have the architecture in place to deal with it. 

That said, inserting the launcher process as a middle man for every worker process is wasteful. Creating processes without fork is expensive. Also, relying on the "__PYVENV_LAUNCHER__" environment variable for this is problematic. Environment variables are inherited by default, so it leaks to a completely unrelated python.exe process. For example, if we run subprocess.call(r'C:\Program Files\Python37\python.exe') from a virtual environment, currently we end up with an overridden sys.executable. I would prefer a -X command-line option, such as "VIRTUAL_ENV". multiprocessing could propagate this option to worker processes.
History
Date User Action Args
2019-01-21 20:06:06eryksunsetrecipients: + eryksun, paul.moore, pitrou, tim.golden, ned.deily, zach.ware, steve.dower, chrullrich, davin
2019-01-21 20:06:05eryksunsetmessageid: <1548101165.38.0.889622149708.issue35797@roundup.psfhosted.org>
2019-01-21 20:06:05eryksunlinkissue35797 messages
2019-01-21 20:06:05eryksuncreate