[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
Victor Stinner
victor.stinner at gmail.com
Wed Jul 24 23:50:08 CEST 2013
2013/7/24 Richard Oudkerk <shibturn at gmail.com>:
>> Wow. Indeed you can -- I just tested this myself. How is this
>> accomplished? I guess the CRT has a backchannel to talk to itself when
>> it creates a process using spawn*?
>
> CreateProcess() takes a STARTUPINFO argument with undocumented fields
> cbReserved2, lpReserved2. They are used to pass an array of fds.
So would it be possible to implement the pass_fds parameter of
subprocess using spawnl() or the undocumented fields?
And is it possible to close all handles except one (implement "pass_handles")?
The idea would be to use something subprocess.Popen(cmd,
pass_fds=[pipe_rfd], close_fds=True) or subprocess.Popen(cmd,
pass_handles=[pipe_rhandle], close_handles=True) instead of
subprocess.Popen(cmd, close_fds=False).
> In the experimental branch of multiprocessing, child processes
> no longer inherit unnecessary handles.
Where is this branch? How did you create the channel between the
manager and the worker?
Victor
More information about the Python-Dev
mailing list