This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: codecs.StreamRecoder.writelines is broken
Type: Stage: resolved
Components: Versions: Python 3.8, Python 3.7, Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: JelleZijlstra, gvanrossum, miss-islington
Priority: normal Keywords: patch

Created on 2018-05-13 14:33 by JelleZijlstra, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6779 merged JelleZijlstra, 2018-05-13 14:37
PR 13501 closed JelleZijlstra, 2019-05-22 15:33
PR 13502 merged JelleZijlstra, 2019-05-22 15:35
Messages (4)
msg316465 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2018-05-13 14:33
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.
msg319343 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2018-06-11 20:48
LGTM. Though sad there's no test that caught this. Could you add one.
msg343200 - (view) Author: miss-islington (miss-islington) Date: 2019-05-22 15:18
New changeset b3be4072888a4ce054993c2801802721466ea02d by Miss Islington (bot) (Jelle Zijlstra) in branch 'master':
bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)
msg343216 - (view) Author: miss-islington (miss-islington) Date: 2019-05-22 16:28
New changeset 81c5ec9e417aebfe92945a05771006e4241f4e08 by Miss Islington (bot) (Jelle Zijlstra) in branch '3.7':
[3.7] bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779) (GH-13502)
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77663
2019-05-22 17:30:28gvanrossumsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-05-22 16:28:42miss-islingtonsetmessages: + msg343216
2019-05-22 15:35:47JelleZijlstrasetpull_requests: + pull_request13417
2019-05-22 15:33:17JelleZijlstrasetstage: test needed -> patch review
pull_requests: + pull_request13416
2019-05-22 15:18:31miss-islingtonsetnosy: + miss-islington
messages: + msg343200
2018-06-11 21:45:14serhiy.storchakasetstage: patch review -> test needed
2018-06-11 20:48:32gvanrossumsetnosy: + gvanrossum
messages: + msg319343
2018-05-13 14:37:56JelleZijlstrasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6465
2018-05-13 14:33:47JelleZijlstracreate