Re: [Python-Dev] C API changes

2018-11-24 Thread Armin Rigo
Hi Stefan, On Sat, 24 Nov 2018 at 22:17, Stefan Behnel wrote: > Couldn't this also be achieved via reference counting? Count only in C > space, and delete the "open object" when the refcount goes to 0? The point is to remove the need to return the same handle to C code if the object is the same

Re: [Python-Dev] C API changes

2018-11-24 Thread Stefan Behnel
Armin Rigo schrieb am 23.11.18 um 14:15: > In PyPy we'd have a global table of > "open objects", and a handle would be an index in that table; closing > a handle means writing NULL into that table entry. No emulated > reference counting needed: we simply use the existing GC to keep alive > objects

[Python-Dev] Usage of tafile.copyfileobj

2018-11-24 Thread Rémi Lapeyre
Hi, I’m working on the tarfile module to add support for file objects whose size is not know beforehand (https://bugs.python.org/issue35227). In doing so, I need to adapt `tarfile.copyfileobj` to return the length of the file after it has been copied. Calling this function with `length=None` curr

Re: [Python-Dev] C API changes

2018-11-24 Thread Nick Coghlan
On Fri, 23 Nov 2018 at 23:24, Armin Rigo wrote (regarding opaque "handles" in the C API): > The C API would change a lot, so it's not reasonable to do that in the > CPython repo. But it could be a third-party project, attempting to > define an API like this and implement it well on top of both CP