This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients ZackerySpytz, daveb, eryksun, josh.r, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2019-07-11.11:02:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562842964.87.0.303022507805.issue37549@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2019-07-11 11:02:44eryksunsetrecipients: + eryksun, paul.moore, vstinner, tim.golden, zach.ware, steve.dower, josh.r, ZackerySpytz, daveb
2019-07-11 11:02:44eryksunsetmessageid: <1562842964.87.0.303022507805.issue37549@roundup.psfhosted.org>
2019-07-11 11:02:44eryksunlinkissue37549 messages
2019-07-11 11:02:44eryksuncreate