[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)

Richard Oudkerk shibturn at gmail.com
Wed Jul 24 20:13:58 CEST 2013


 > 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.

 > But I'm also ready to propose that all this is such a mess that we
> *should* change the default fd/handle inheritance to False, *across
> platforms*, and damn the torpedoes -- i.e. accept breaking all
> existing 3rd party UNIX code for subprocess creation that bypasses the
> subprocess module, as well as breaking uses of os.spawn*() on both
> platforms that depend on FD inheritance beyond stdin/stdout/stderr).

+1

> We can fix multiprocessing any anything else in the stdlib that this
> breaks, I presume.

In the experimental branch of multiprocessing, child processes no longer 
inherit unnecessary handles.

--
Richard


More information about the Python-Dev mailing list