Author Oren Milman
Recipients Oren Milman
Date 2017-08-24.18:06:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
currently, the following causes an assertion in Modules/_io/textio.c in
_io_TextIOWrapper_write_impl() to fail:
import codecs
import io

class BadEncoder():
    def encode(self, dummy):
        return 42
def _get_bad_encoder(dummy):
    return BadEncoder()

quopri = codecs.lookup("quopri")
quopri._is_text_encoding = True
quopri.incrementalencoder = _get_bad_encoder
t = io.TextIOWrapper(io.BytesIO(b'foo'), encoding="quopri")

this is because _io_TextIOWrapper_write_impl() doesn't check whether the value
returned by encoder's encode() is a bytes object.

(I would open a PR to fix that soon.)
Date User Action Args
2017-08-24 18:06:29Oren Milmansetrecipients: + Oren Milman
2017-08-24 18:06:29Oren Milmansetmessageid: <>
2017-08-24 18:06:29Oren Milmanlinkissue31271 messages
2017-08-24 18:06:28Oren Milmancreate