(original) (raw)


On 23 July 2013 23:45, Victor Stinner <victor.stinner@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