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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 14 06:28:39 CEST 2007


Travis E. Oliphant wrote:

I would want to encourage people not to use the LOCKFORREAD unless there is an important benefit or need to use it.

If you mean that LOCK_FOR_READ would unilaterally deny anyone else read access, my proposal avoids this by not having such a mode at all. So you can always get read access if you really want it.

But I expect that most of the time you'll at least want to make sure nobody is writing while you're trying to read. In my terminology you spell that READ | EXCLUDE_WRITE.

Let me think about adding a function for read-write locking that is separate from getting a view (which implements memory-location locking).

I'm not sure it needs to be a separate function, just a clearly separated set of options in the flags.

Remember that clients are only supposed to be holding a buffer for as short a time as possible. It's most likely that the same read/write locking options are going to apply for the whole duration of a buffer operation, I think.

-- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+



More information about the Python-3000 mailing list