This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ryosuke Ito
Recipients Ryosuke Ito
Date 2015-10-29.14:12:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446127939.75.0.173725539565.issue25510@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-10-29 14:12:19Ryosuke Itosetrecipients: + Ryosuke Ito
2015-10-29 14:12:19Ryosuke Itosetmessageid: <1446127939.75.0.173725539565.issue25510@psf.upfronthosting.co.za>
2015-10-29 14:12:19Ryosuke Itolinkissue25510 messages
2015-10-29 14:12:19Ryosuke Itocreate