[Python-3000] patch: bytes object PyBUF_LOCKDATA read-only and immutable support (original) (raw)

Gregory P. Smith greg at krypto.org
Sat Sep 15 20:11:33 CEST 2007


On 9/13/07, Travis E. Oliphant <oliphant at enthought.com> wrote:

I think if it doesn't go through the buffer interface it is up to the object to decide (i.e. what does the object do with itself when buffers are exported --- that will depend on the object). All it must do is support the buffer interface in the correct way (i.e. not move the memory buffers are relying on and support the access modes correctly that it purports to export).

Correct. This is what I have done in my Bytes object patch to support READ | EXCLUDE_WRITE (speaking in Greg Ewing's terms which I think we should adopt).

Let me think about adding a function for read-write locking that is separate from getting a view (which implements memory-location locking). I appreciate the discussion as it is helping me clarify my thinking.

-Travis

I'm interested to see what you come up with but... As it is, I agree with Greg Ewing that a separate function is not necessary and that just an set of flags to the existing buffer interface are all thats needed. Otherwise code would need to make multiple calls (get, lock, unlock, release) and deal with errors when both do not succeed which is complicated and error prone to do in C when a single call could encapsulate it.

-gps



More information about the Python-3000 mailing list