[issue30555] _io._WindowsConsoleIO breaks in the face of fd redirection

Eryk Sun report at bugs.python.org
Mon Mar 15 21:50:21 EDT 2021


Eryk Sun <eryksun at gmail.com> added the comment:

PR 1927 is a definite improvement. By using _get_osfhandle() instead of caching the handle value, it guarantees that access to the original console file can be saved and restored via `fd_save = dup(fd)` and `dup2(fd_save, fd)`. It also allows duping a new open of CON, CONIN$, or CONOUT$, or even a new screen buffer from CreateConsoleScreenBuffer(), to the existing fileno(), and the _WindowsConsoleIO() instance will march along none the wiser.

----------
stage:  -> patch review
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30555>
_______________________________________


More information about the Python-bugs-list mailing list