[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)
Richard Oudkerk
shibturn at gmail.com
Wed Jul 24 20:36:48 CEST 2013
On 24/07/2013 7:17pm, Guido van Rossum wrote:
> Does it also inherit sockets (which take up a different namespace than
> regular FDs in CRT, unlike UNIX)?
Not reliably. Processes created with CreateProcess() seems to inherit
socket handles just like normal handles on my computer, but on some
other computers -- with the same Windows version! -- it appears not to
work. See http://bugs.python.org/issue17399.
I think WSADuplicateSocket() should be used instead.
> And if we default individual handles to uninheritable, we can
> presumably fix the ones that multiprocessing creates with the express
> purpose of being inherited easily. (If it even uses that -- I haven't
> read the source code, maybe it uses named pipes?
multiprocessing never really needs to create any inheritable handles: it
can use DuplicateHandle() to transfer each handle directly to the child
process.
--
Richard
More information about the Python-Dev
mailing list