Skip to content

codecs.StreamRecoder.writelines is broken #77663

Closed

Description

@JelleZijlstra
BPO 33482
Nosy @gvanrossum, @JelleZijlstra, @miss-islington
PRs
  • bpo-33482: fix codecs.StreamRecoder.writelines #6779
  • [3.6] bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779) #13501
  • [3.7] bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779) #13502
  • 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 2019-05-22.17:30:28.300>
    created_at = <Date 2018-05-13.14:33:47.481>
    labels = ['3.7', '3.8']
    title = 'codecs.StreamRecoder.writelines is broken'
    updated_at = <Date 2019-05-22.17:30:28.300>
    user = 'https://github.com/JelleZijlstra'

    bugs.python.org fields:

    activity = <Date 2019-05-22.17:30:28.300>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-22.17:30:28.300>
    closer = 'gvanrossum'
    components = []
    creation = <Date 2018-05-13.14:33:47.481>
    creator = 'JelleZijlstra'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33482
    keywords = ['patch']
    message_count = 4.0
    messages = ['316465', '319343', '343200', '343216']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'JelleZijlstra', 'miss-islington']
    pr_nums = ['6779', '13501', '13502']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33482'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. JelleZijlstra commented on May 13, 2018

      @JelleZijlstra
      MemberAuthor

      codecs.StreamRecoder.writelines is implemented as:

          def writelines(self, list):
          data = ''.join(list)
          data, bytesdecoded = self.decode(data, self.errors)
          return self.writer.write(data)
      

      It can't take a list of bytes because then the ''.join throws an error, and it can't take a list of str because self.decode takes bytes.

      It looks like bytes are intended (self.write takes bytes), so I'll submit a simple PR to fix this.

    2. gvanrossum commented on Jun 11, 2018

      @gvanrossum
      Member

      LGTM. Though sad there's no test that caught this. Could you add one.

    3. miss-islington commented on May 22, 2019

      @miss-islington
      Contributor

      New changeset b3be407 by Miss Islington (bot) (Jelle Zijlstra) in branch 'master':
      bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)
      b3be407

    4. miss-islington commented on May 22, 2019

      @miss-islington
      Contributor

      New changeset 81c5ec9 by Miss Islington (bot) (Jelle Zijlstra) in branch '3.7':
      [3.7] bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779) (GH-13502)
      81c5ec9

    5. 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

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions