[New-bugs-announce] [issue28163] WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle
Eryk Sun
report at bugs.python.org
Wed Sep 14 23:26:21 EDT 2016
New submission from Eryk Sun:
WindowsConsoleIO fileno() gets a file descriptor on demand by calling _open_osfhandle. As a low I/O function this expects _open flags, but currently the code is passing 'rb' (int 0x7262) and 'wb' (int 0x7762). It should use _O_RDONLY | _O_BINARY and _O_WRONLY | _O_BINARY.
Actually, _open_osfhandle isn't actually opening the file, so it only cares about a few flags. Specifically, in lowio\osfinfo.cpp I see that it looks for _O_APPEND, _O_TEXT, and _O_NOINHERIT. So in this case passing 0 for the flags would also be ok.
----------
components: IO, Library (Lib), Windows
messages: 276509
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle
type: behavior
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28163>
_______________________________________
More information about the New-bugs-announce
mailing list