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.

Author nikratio
Recipients nikratio
Date 2014-03-25.04:14:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In Python 3.4, TextIOWrapper can not read from streams that return bytearrays or memoryviews:

from io import TextIOWrapper, BytesIO
class MyByteStream(BytesIO):
    def read1(self, len_):
        return memoryview(super().read(len_))
bs = MyByteStream(b'some data in ascii\n')
ss = TextIOWrapper(bs, encoding='ascii')

results in:

TypeError: underlying read1() should have returned a bytes object, not 'memoryview'

I don't think there's any good reason for TextIOWrapper not accepting any bytes-like object (especially now that b''.join finally accepts bytes-like objects as well).
Date User Action Args
2014-03-25 04:14:29nikratiosetrecipients: + nikratio
2014-03-25 04:14:29nikratiosetmessageid: <>
2014-03-25 04:14:29nikratiolinkissue21057 messages
2014-03-25 04:14:29nikratiocreate