[New-bugs-announce] [issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode
Ryosuke Ito
report at bugs.python.org
Thu Oct 29 10:12:19 EDT 2015
New submission from Ryosuke Ito:
In Python3, fileinput.FileInput.readline() always returns str object at the end,
even if in 'rb' mode.
Here's a test code.
import fileinput
fi = fileinput.input('test_fileinput.py', mode='rb')
while True:
line = fi.readline()
assert isinstance(line, bytes)
if not len(line):
break
It fails in Python3.2 to 3.5.
I wrote a patch for this.
With it, the test above passes.
----------
files: fileinput.py.diff
keywords: patch
messages: 253675
nosy: Ryosuke Ito
priority: normal
severity: normal
status: open
title: fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode
Added file: http://bugs.python.org/file40895/fileinput.py.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25510>
_______________________________________
More information about the New-bugs-announce
mailing list