summaryrefslogtreecommitdiff
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-01 16:43:58 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-01 16:43:58 +0200
commit314464d0ab4ad283fce7594158b2464d47cc68d8 (patch)
tree365304a1c140df7cb90a1cb501f18713226580c8 /Lib/fileinput.py
parent1f1177d69a21805c374b6b4cfce9f9f76bceb822 (diff)
downloadcpython-git-314464d0ab4ad283fce7594158b2464d47cc68d8.tar.gz
Issue #25510: fileinput.FileInput.readline() now returns b'' instead of ''
at the end if the FileInput was opened with binary mode. Patch by Ryosuke Ito.
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 8af4a57f02..81a7545dd8 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -315,7 +315,10 @@ class FileInput:
return line
if not self._file:
if not self._files:
- return ""
+ if 'b' in self._mode:
+ return b''
+ else:
+ return ''
self._filename = self._files[0]
self._files = self._files[1:]
self._filelineno = 0