Message214893
> 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. Example:
>>> data=b'abcdef'
>>> x=io.BytesIO(data)
>>> x.read() is data
False
Before trying to avoid copies in the "buffered" layer, something should be done for the "raw" layer (BytesIO in this case). |
|
Date |
User |
Action |
Args |
2014-03-26 10:43:15 | vstinner | set | recipients:
+ vstinner, pitrou, nikratio, serhiy.storchaka |
2014-03-26 10:43:14 | vstinner | set | messageid: <1395830594.98.0.638444524541.issue21057@psf.upfronthosting.co.za> |
2014-03-26 10:43:14 | vstinner | link | issue21057 messages |
2014-03-26 10:43:14 | vstinner | create | |
|