Eryk Sun <[email protected]> added the comment:
> os.dup() doc says: "On Windows, when duplicating a standard stream
> (0: stdin, 1: stdout, 2: stderr), the new file descriptor is
> inheritable."
That's not necessarily correct. For example, if stdout is a pipe or disk file:
C:\>python -V
Python 3.7.3
C:\>python -c "import os; fd = os.dup(1); print(os.get_inheritable(fd))" |
more
False
C:\>python -c "import os; fd = os.dup(1); print(os.get_inheritable(fd))" >
stdout.txt
C:\>type stdout.txt
False
What 3.7.3 does is to skip calling _Py_set_inheritable for all files of type
FILE_TYPE_CHAR, which is wrong for character devices in general, such as NUL
and serial ports. NUL is a common target for standard I/O redirection.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37549>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com