Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codecs.StreamRecoder.writelines is broken #77663

Closed
JelleZijlstra opened this issue May 13, 2018 · 4 comments
Closed

codecs.StreamRecoder.writelines is broken #77663

JelleZijlstra opened this issue May 13, 2018 · 4 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life

Comments

@JelleZijlstra
Copy link
Member

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

    @JelleZijlstra
    Copy link
    Member Author

    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.

    @JelleZijlstra JelleZijlstra added 3.7 (EOL) end of life 3.8 (EOL) end of life labels May 13, 2018
    @gvanrossum
    Copy link
    Member

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

    @miss-islington
    Copy link
    Contributor

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

    @miss-islington
    Copy link
    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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants