[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-11-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e27c589e1c6a by Serhiy Storchaka in branch '3.4':
Issue #25510: fileinput.FileInput.readline() now returns b'' instead of ''
https://hg.python.org/cpython/rev/e27c589e1c6a

New changeset 321b34824020 by Serhiy Storchaka in branch '3.5':
Issue #25510: fileinput.FileInput.readline() now returns b'' instead of ''
https://hg.python.org/cpython/rev/321b34824020

New changeset 4f0e293e6eb0 by Serhiy Storchaka in branch 'default':
Issue #25510: fileinput.FileInput.readline() now returns b'' instead of ''
https://hg.python.org/cpython/rev/4f0e293e6eb0

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-11-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Ryosuke for your contribution.

--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-11-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

I don't think we should care about breaking backward compatibility here. Most 
code tests end-of-files with "not line" or "len(line) == 0", and this work with 
fixed fileinput as well as with broken. That is why we have received this bug 
report now, after many years since releasing 3.0.

--
assignee:  -> serhiy.storchaka
stage: test needed -> commit review
versions: +Python 3.4, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-11-01 Thread R. David Murray

R. David Murray added the comment:

Ah, I misunderstood the bug report.  Yes, this should be OK (I hope :).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-10-29 Thread Ryosuke Ito

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-10-29 Thread Ryosuke Ito

Changes by Ryosuke Ito :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-10-29 Thread Ryosuke Ito

Changes by Ryosuke Ito :


--
components: +Library (Lib)
versions: +Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-10-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Would be nice to add a test in Lib/test/test_fileinput.py.

--
nosy: +serhiy.storchaka
stage:  -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25510] fileinput.FileInput.readline() always returns str object at the end even if in 'rb' mode

2015-10-29 Thread R. David Murray

R. David Murray added the comment:

We need to think carefully about backward compatibility here.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com