Roundup Robot added the comment:
New changeset ded1336bff49 by R David Murray in branch '3.5':
#22709: Use stdin as-is if it does not have a buffer attribute.
https://hg.python.org/cpython/rev/ded1336bff49
--
___
Python tracker
Changes by Serhiy Storchaka storch...@gmail.com:
--
assignee: - serhiy.storchaka
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21075
___
Roundup Robot added the comment:
New changeset 7e640fefc9c1 by Serhiy Storchaka in branch '3.4':
Issue #21075: fileinput.FileInput now reads bytes from standard stream if
http://hg.python.org/cpython/rev/7e640fefc9c1
New changeset 4041d4077a85 by Serhiy Storchaka in branch 'default':
Issue
Serhiy Storchaka added the comment:
Thank you Sam for your contribution.
--
resolution: - fixed
stage: - resolved
status: open - closed
versions: +Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21075
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21075
___
___
Python-bugs-list
Sam Kimbrel added the comment:
Patch attached that checks for 'b' in self._mode and sets self._file to
sys.stdin.buffer as appropriate.
--
keywords: +patch
nosy: +sam.kimbrel
Added file: http://bugs.python.org/file34880/21075-fileinput-stdin.diff
New submission from Brandon Rhodes:
In Python 3, fileinput.input() returns str lines whether the data is
coming from stdin or from a list of files on the command line. But if
input(mode='rb') is specified, then its behavior becomes inconsistent:
lines from stdin are delivered as already-decoded
Josh Rosenberg added the comment:
There is a similar, (unfixed?) bug, #14156, in argparse as well. Seems like a
common failing in the move to Python 3; std*.buffer was introduced, but none of
the places that use it were updated, so they all became str only.
--
nosy: +josh.rosenberg