summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-01 14:45:26 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-01 14:45:26 (GMT)
commit56275dc1e2a2f354620189efd751fa90af2118e1 (patch)
tree4912005e11192ecc7edac3899e72bc2c8f0460ea /Lib/fileinput.py
parent14eefe353e3f251bce0bc7ed3415f78c17174d94 (diff)
parent314464d0ab4ad283fce7594158b2464d47cc68d8 (diff)
downloadcpython-56275dc1e2a2f354620189efd751fa90af2118e1.zip
cpython-56275dc1e2a2f354620189efd751fa90af2118e1.tar.gz
cpython-56275dc1e2a2f354620189efd751fa90af2118e1.tar.bz2
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 af810d1..c41b94a 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