[issue31025] io.BytesIO: no way to get the length of the underlying buffer without copying data

2017-07-26 Thread Arthur Darcet
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

[issue31025] io.BytesIO: no way to get the length of the underlying buffer without copying data

2017-07-25 Thread Arthur Darcet
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 usec per loop %

[issue31025] io.BytesIO: no way to get the length of the underlying buffer without copying data

2017-07-25 Thread Arthur Darcet
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 = BytesIO(b'data'); d = b.get

[issue30679] __aexit__ not called when `run_until_complete` is interrupted by SIGINT

2017-06-15 Thread Arthur Darcet
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 <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30679] __aexit__ not called when `run_until_complete` is interrupted by SIGINT

2017-06-15 Thread Arthur Darcet
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(): async

[issue29406] asyncio SSL contexts leak sockets after calling close with certain Apache servers

2017-06-13 Thread Arthur Darcet
Changes by Arthur Darcet <arthur+pyt...@darcet.fr>: -- nosy: +rthr ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29406> ___ _

Re: cryptography default_backend is "hazmat"?

2017-03-18 Thread Arthur Darcet
On Sat, 18 Mar 2017 at 23:29, Ian Pilcher wrote: > On 03/18/2017 05:15 PM, Chris Angelico wrote: > > So the question is: How well do you trust the examples? Are they > > likely to be instructing you in a safe way to use this > > potentially-dangerous module? > > But as far

[issue6818] remove/delete method for zipfile/tarfile objects

2013-04-11 Thread Arthur Darcet
Changes by Arthur Darcet arthur.dar...@gmail.com: -- nosy: +Arthur.Darcet ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6818 ___ ___ Python-bugs