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

Paul Moore p.f.moore at gmail.com
Wed Jul 24 08:29:44 CEST 2013


On 23 July 2013 23:45, Victor Stinner <victor.stinner at gmail.com> wrote:

> Said differently: the HANDLE_FLAG_INHERIT flag only has an effect on
> *handles*, as indicated in its name. On Windows, file *descriptors*
> are never inherited (are always closed) in child processes. I don't
> think that it is possible to inherit file descriptors on Windows.
>

That is correct - handles are the OS-level concept, fds are implemented in
the CRT. So code that uses raw Windows APIs to create a new process won't
have any means to inherit fds.


> The fix would be simpler if Python would provide the handle of a file
> object (ex: in a method) and if open() supported opening a handle as
> it does with file descriptors on UNIX.
>

That would give a similar level of functionality to Unix. Whether it is
used sufficiently often to be worth it, is a separate question, of course...

Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130724/dae97907/attachment.html>


More information about the Python-Dev mailing list