Eryk Sun <[email protected]> added the comment:
The Windows implementation shouldn't map file-descriptor values 0, 1, and 2 to
the process standard handles. fileno(stdout) may not even be 1 in some cases.
It should use `handle = _get_osfhandle(fd)`, which is more generally correct
and not limited to hard-coded defaults.
Regarding this issue, the docs should clarify that the Windows console's input
buffer cannot be used to get the screen buffer size. Typically the input buffer
is STDIN_FILENO (0) or opened via "CONIN$" or "CON" (read mode). Thus there is
no point to checking stdin in Windows since it will always fail.
I agree that the default behavior should be extended to check a
platform-dependent tty/console device. In Windows this is `fd =
_open("CONOUT$", _O_RDWR)`.
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue14841>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com