Issue 11311: StringIO.readline(0) returns incorrect results (original ) (raw )Created on 2011-02-24 21:32 by nnnnnn , last changed 2022-04-11 14:57 by admin . This issue is now closed .
Messages (5)
msg129314 - (view)
Author: (nnnnnn) *
Date: 2011-02-24 21:32
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00) [GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import StringIO >>> StringIO.StringIO("foo").readline(0) 'foo' I don't think this is the correct behavior, or at least it is not consistent with other file objects' readline() which return an empty string with .readline(0). For example: >>> import cStringIO >>> cStringIO.StringIO("foo").readline(0) '' ...or: >>> file("/usr/bin/python").readline(0) ''
msg129331 - (view)
Author: Alex Gaynor (alex) *
Date: 2011-02-25 04:26
Fun fact: io.StringIO does the right thing, but _io and _pyio.
msg181523 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2013-02-06 13:37
Here is a very simple patch.
msg182013 - (view)
Author: Roundup Robot (python-dev)
Date: 2013-02-13 10:27
New changeset 7513bd184a01 by Serhiy Storchaka in branch '2.7': Issue #11311 : StringIO.readline(0) now returns an empty string as all other http://hg.python.org/cpython/rev/7513bd184a01
msg182016 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2013-02-13 10:40
Fixed. Thank you for the report, Ville.
History
Date
User
Action
Args
2022-04-11 14:57:13
admin
set
github: 55520
2013-02-13 10:40:40
serhiy.storchaka
set
status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2013-02-13 10:27:56
python-dev
set
nosy: + python-dev messages: +
2013-02-12 23:44:32
serhiy.storchaka
set
assignee: serhiy.storchaka
2013-02-06 13:37:11
serhiy.storchaka
set
files: + StringIO_readline0.patch keywords: + patch messages: + stage: needs patch -> patch review
2013-02-06 09:44:39
serhiy.storchaka
set
keywords: + easy nosy: + serhiy.storchaka components: + IOstage: needs patch
2011-02-25 04:26:51
alex
set
nosy: + alex messages: +
2011-02-24 21:32:21
nnnnnn
create