[Python-3000] Single buffer implied in new buffer protocol?
Travis Oliphant
oliphant.travis at ieee.org
Fri May 30 10:21:59 CEST 2008
Stefan Behnel wrote:
> Travis Oliphant wrote:
>> Stefan Behnel wrote:
>>> Anyway, my point is that this part of the protocol actually implies
>>> setting a
>>> lock on the buffer *provider* rather than the buffer itself, as the
>>> buffer
>>> provider cannot distinguish between different buffers based on a NULL
>>> pointer
>> Yes, the language in the PEP could be more clear. Obviously, if you
>> haven't provided a Py_buffer structure to fill in, then you are only
>> asking to lock the object's buffer from other access.
>
> That's what I'm questioning below.
>
I see what you are referring to. The protocol to lock the buffer after
requesting and obtaining one was not well thought out. I think the use
case I had in mind was locking in the buffer before actually getting it.
Once you have a buffer, I see how you may want to lock the buffer after
getting it. For example, I could see how you may want to go from a
non-locked read/write where you are guaranteed by the object that it
won't move the memory but not that someone hasn't written to the memory
area to an exclusive write-lock where no-one else can write to the area
until you are done.
This should be clarified in the PEP. Can you take a stab at it?
-Travis
More information about the Python-3000
mailing list