[New-bugs-announce] [issue11311] StringIO.readline(0) returns incorrect results

Ville Skyttä report at bugs.python.org
Thu Feb 24 22:32:22 CET 2011


New submission from Ville Skyttä <ville.skytta at iki.fi>:

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)
''

----------
components: Library (Lib)
messages: 129314
nosy: scop
priority: normal
severity: normal
status: open
title: StringIO.readline(0) returns incorrect results
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11311>
_______________________________________


More information about the New-bugs-announce mailing list