Author vstinner
Recipients Bernt.Røskar.Brenna, Segev Finer, eryksun, paul.moore, sbt, steve.dower, tim.golden, vstinner, zach.ware
Date 2017-01-06.22:42:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483742571.33.0.186013652789.issue19764@psf.upfronthosting.co.za>
In-reply-to
Content
Python already has a multiprocessing module which is able to pass handles (maybe also FD? I don't know) to child processes on Windows. I found some code in Lib/multiprocessing/reduction.py:
- duplicate()
- steal_handle()
- send_handle()

But the design doesn't really fit the subprocess module, since this design requires that the child process communicates with the parent process. On UNIX, fork()+exec() is used, so we can execute a few instructions after fork, which allows to pass an exception from the child to the parent. On Windows, CreateProcess() is used which doesn't allow directly to execute code before running the final child process.

The PEP 446 describes a solution using a wrapper process, so parent+wrapper+child, 3 processes. IMHO the best design for subprocess is really PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
History
Date User Action Args
2017-01-06 22:42:51vstinnersetrecipients: + vstinner, paul.moore, tim.golden, Bernt.Røskar.Brenna, sbt, zach.ware, eryksun, steve.dower, Segev Finer
2017-01-06 22:42:51vstinnersetmessageid: <1483742571.33.0.186013652789.issue19764@psf.upfronthosting.co.za>
2017-01-06 22:42:51vstinnerlinkissue19764 messages
2017-01-06 22:42:51vstinnercreate