summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-05-14 18:08:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-05-14 18:08:33 (GMT)
commit946cfc3e238bbd67ff436af5fd05414bbd2e5a08 (patch)
treeb8bc5c17edf6498d5f09253315b9a4e46d75c86c /Lib/fileinput.py
parente2d66903e8e336817702213f0cd8c3a24edf03ac (diff)
downloadcpython-946cfc3e238bbd67ff436af5fd05414bbd2e5a08.zip
cpython-946cfc3e238bbd67ff436af5fd05414bbd2e5a08.tar.gz
cpython-946cfc3e238bbd67ff436af5fd05414bbd2e5a08.tar.bz2
Issue #21075: fileinput.FileInput now reads bytes from standard stream if
binary mode is specified. Patch by Sam Kimbrel.
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r--Lib/fileinput.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index de29518..87758ad 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -320,7 +320,10 @@ class FileInput:
self._backupfilename = 0
if self._filename == '-':
self._filename = '<stdin>'
- self._file = sys.stdin
+ if 'b' in self._mode:
+ self._file = sys.stdin.buffer
+ else:
+ self._file = sys.stdin
self._isstdin = True
else:
if self._inplace: