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

Created on 2018-05-13 14:33 by Jelle Zijlstra, last changed 2019-05-22 17:30 by gvanrossum. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6779 merged Jelle Zijlstra, 2018-05-13 14:37
PR 13501 closed Jelle Zijlstra, 2019-05-22 15:33
PR 13502 merged Jelle Zijlstra, 2019-05-22 15:35
Messages (4)
msg316465 - (view) Author: Jelle Zijlstra (Jelle Zijlstra) * (Python triager) 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)
https://github.com/python/cpython/commit/b3be4072888a4ce054993c2801802721466ea02d
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)
https://github.com/python/cpython/commit/81c5ec9e417aebfe92945a05771006e4241f4e08
History
Date User Action Args
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:47Jelle Zijlstrasetpull_requests: + pull_request13417
2019-05-22 15:33:17Jelle Zijlstrasetstage: 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:56Jelle Zijlstrasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6465
2018-05-13 14:33:47Jelle Zijlstracreate