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

Steve Dower report at bugs.python.org
Fri Jun 2 13:59:01 EDT 2017


Steve Dower added the comment:

> We can also switch to calling _get_osfhandle always instead of caching the handle, it will break when the fd is redirected to a non-console. But so does _WindowsConsoleIO in general since it will try to continue writing to the console despite the redirection, meaning that Python code doing redirection has to handle sys.std* anyhow.

This might be the best approach, ultimately. I bet there's an optimization here, though it's not obvious.

Probably the main issue here is readline not properly handling sys.std*. If that was fixed, I think many of these problems (at least at the interactive prompt) would simply go away.

----------

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


More information about the Python-bugs-list mailing list