Serhiy Storchaka added the comment:
Calling the openhook for the stdin will break existing code. Third-party
openhooks don't special case the '<stdin>' name, which is legitimate file name.
Instead I recommend to patch sys.stdin explicitly in your program.
sys.stdin = io.TextIOWrapper(sys.stdin.buffer, errors='replace')
for line in fileinput.input(openhook=hook):
...
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com