[Python-3000] Single buffer implied in new buffer protocol?
greg.ewing at canterbury.ac.nz
Wed Jun 4 03:49:00 CEST 2008
I don't understand all this stuff about getting unlocked
buffers and unlocking buffers while keeping them alive,
The way I thought this was supposed to work is that the
buffer is *always* locked while the client is accessing
it, the only choice being whether it's a read-only or
So the usage sequence is:
1) Client calls getbuffer() and receives a buffer
pointer. The memory referred to by the pointer
is now locked and will not move.
2) Client accesses the memory via the returned pointer.
3) Client calls releasebuffer(). The memory is now
unlocked and the pointer is no longer valid.
If the client wants to access the buffer again, it
must go back to step 1.
Are there use cases for which this sequence is not
More information about the Python-3000