diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-01 14:45:54 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-01 14:45:54 (GMT) |
| commit | 17bdf2015d8c46d6418ad7b8742a4fb0d277a642 (patch) | |
| tree | 52b5aada60471174cf331f2f5ea594354cea54b8 /Lib/fileinput.py | |
| parent | 9b69491901045bcaff15fd9de9eb4c888cc5a3bd (diff) | |
| parent | 56275dc1e2a2f354620189efd751fa90af2118e1 (diff) | |
| download | cpython-17bdf2015d8c46d6418ad7b8742a4fb0d277a642.zip cpython-17bdf2015d8c46d6418ad7b8742a4fb0d277a642.tar.gz cpython-17bdf2015d8c46d6418ad7b8742a4fb0d277a642.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.py | 5 |
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 |
