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.

classification
Title: StringIO.StringIO('foo').readline(0) == 'foo'
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Zdeněk.Pavlas, pitrou, r.david.murray
Priority: normal Keywords: patch

Created on 2013-10-10 09:57 by Zdeněk.Pavlas, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
stringio.patch Zdeněk.Pavlas, 2013-10-10 09:57
Messages (2)
msg199376 - (view) Author: Zdeněk Pavlas (Zdeněk.Pavlas) Date: 2013-10-10 09:57
The behavior contradicts documentation and is inconsistent with both cStringIO and File objects.  Patch attached.

>>> StringIO.StringIO('foo').readline(0)
'foo'
>>> cStringIO.StringIO('foo').readline(0)
''
>>> open('/etc/passwd').readline(0)
''
msg199382 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-10-10 11:44
Oops, I was too quick with that nosy.  This bug is fixed in io.StringIO, which means it is fixed in Python3.  And sorry to say, it shouldn't be fixed in a maintenance release, since it is a behavior change that could break working programs.
History
Date User Action Args
2022-04-11 14:57:51adminsetgithub: 63414
2013-10-10 11:44:12r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg199382

resolution: out of date
stage: resolved
2013-10-10 11:40:48r.david.murraysetnosy: + pitrou
2013-10-10 09:57:59Zdeněk.Pavlascreate