[Python-Dev] ctypes, memory mapped files and context manager
eryk sun
eryksun at gmail.com
Thu Jan 5 21:36:48 EST 2017
More information about the Python-Dev mailing list
Thu Jan 5 21:36:48 EST 2017
- Previous message (by thread): [Python-Dev] ctypes, memory mapped files and context manager
- Next message (by thread): [Python-Dev] ctypes, memory mapped files and context manager
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Jan 5, 2017 at 11:28 PM, Hans-Peter Jansen <hpj at urpla.net> wrote: > Leaves the question, how stable this "interface" is? > Accessing _objects here belongs to voodoo programming practices of course, but > the magic is locally limited to just two lines of code, which is acceptable in > order to get this context manager working without messing with the rest of the > code. My intent was not to suggest that anyone directly use the _objects value / dict in production code. It's a private implementation detail. I was demonstrating the problem of simply releasing the buffer and the large number of checks that would be required if b_ptr is cleared. It would be simpler for a release() method to allocate new memory for the object and set the b_needsfree flag, but this may hide bugs. Operating on a released object should raise an exception.
- Previous message (by thread): [Python-Dev] ctypes, memory mapped files and context manager
- Next message (by thread): [Python-Dev] ctypes, memory mapped files and context manager
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list