Skip to content

StringIO failure when reading a chunk of text without newlines #49514

Closed

Description

@pitrou
BPO 5264
Nosy @pitrou, @avassalotti, @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-03-04.21:38:57.808>
created_at = <Date 2009-02-14.22:31:40.845>
labels = ['type-bug', 'library']
title = 'StringIO failure when reading a chunk of text without newlines'
updated_at = <Date 2009-03-04.21:38:57.807>
user = 'https://github.com/pitrou'

bugs.python.org fields:

activity = <Date 2009-03-04.21:38:57.807>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-03-04.21:38:57.808>
closer = 'benjamin.peterson'
components = ['Library (Lib)']
creation = <Date 2009-02-14.22:31:40.845>
creator = 'pitrou'
dependencies = []
files = []
hgrepos = []
issue_num = 5264
keywords = []
message_count = 2.0
messages = ['82131', '83144']
nosy_count = 3.0
nosy_names = ['pitrou', 'alexandre.vassalotti', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'needs patch'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue5264'
versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7']

Activity

  1. pitrou commented on Feb 14, 2009

    @pitrou
    MemberAuthor
    >>> 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
  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or error
    on Feb 14, 2009
  3. benjaminp commented on Mar 4, 2009

    @benjaminp
    Contributor

    This is fixed by the io-c branch merge. (r70152)

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions