[issue21057] TextIOWrapper does not support reading bytearrays or memoryviews
Nikolaus Rath
report at bugs.python.org
Wed Mar 26 16:17:27 CET 2014
Nikolaus Rath added the comment:
On 03/26/2014 03:43 AM, STINNER Victor wrote:
>> class MyByteStream(BytesIO):
>> def read1(self, len_):
>> return memoryview(super().read(len_))
>> bs = MyByteStream(b'some data in ascii\n')
>
> I guess that you are trying to implement a zero-copy I/O. The problem is that BytesIO does copy data.
Right on the first count, but wrong on the second. The class I'm
concerned with wants to do zero-copy I/O, but is not related to BytesIO.
I only picked that to produce a minimal example.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21057>
_______________________________________
More information about the Python-bugs-list
mailing list