Arthur Darcet added the comment:
BytesIO is heavily optimised to avoid copying bytes when it can.
For case (1), if you want to modify the data, then there is no need to actually
copy it before overwriting it, because no-one else is using it
For case (2), if you want to change something, then
Arthur Darcet added the comment:
it's a tiny bit slow, but that works, thank you. I guess we can close this
% python -m timeit -s "import io; b = io.BytesIO(b'0' * 2 ** 30)" "p =
b.tell(); b.seek(0, 2); b.tell(); b.seek(p)"
100 loops, best of 3: 0.615 u
New submission from Arthur Darcet:
If I'm not mistaken, a BytesIO buffer can be in three states:
(1) `b = BytesIO(b'data')` -> free of any constraints
(2) `d = b'data'; b = BytesIO(d)` -> cannot modify the underlying bytes
without copying them
(3) `b = By
Arthur Darcet added the comment:
Ok, thank you. I'm guessing the patch I proposed in the PR is not an option,
for my curiosity, why is that?
--
___
Python tracker
<http://bugs.python.org/is
New submission from Arthur Darcet:
Here is the example code I am running:
```
import asyncio
class it:
async def __aenter__(self):
return self
async def __aexit__(self, *_):
print('EXIT')
async def main():
asy
Changes by Arthur Darcet :
--
nosy: +rthr
___
Python tracker
<http://bugs.python.org/issue29406>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Arthur Darcet :
--
nosy: +Arthur.Darcet
___
Python tracker
<http://bugs.python.org/issue6818>
___
___
Python-bugs-list mailing list
Unsubscribe: