[issue5264] StringIO failure when reading a chunk of text without newlines

Antoine Pitrou report at bugs.python.org
Sat Feb 14 23:31:51 CET 2009


New submission from Antoine Pitrou <pitrou at free.fr>:

>>> f = io.StringIO("a\r\n", newline=None)
>>> f.read(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/antoine/py3k/__svn__/Lib/io.py", line 2007, in read
    res = self._decode_newlines(self._read(n), True)
  File "/home/antoine/py3k/__svn__/Lib/io.py", line 1953, in
_decode_newlines
    return output
UnboundLocalError: local variable 'output' referenced before assignment

----------
components: Library (Lib)
messages: 82131
nosy: alexandre.vassalotti, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: StringIO failure when reading a chunk of text without newlines
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

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


More information about the Python-bugs-list mailing list