KKH wrote: > it seems the whole locking-theme has gone from PEP 3118 (PyBUF_LOCK is > gone). Yet the string and byte objects seem to provide locked buffers > through PyArg_Parse arguments s*, y* and z* (documentation says so).
Might be a left-over. All locking the buffer interface itself provides is the guarantee that the buffer will not move between getting and releasing a buffer. Everything else must be handled at the application level. > Could someone please clarify the situation for me: Is it save to release > the GIL after getting a reference to a buffer-object by the arguments > above and only talking to this buffer while the GIL is gone? The buffer interface is a pure C level interface. All you get is a pointer to a memory buffer plus some meta data. No Python references are involved from that point on. So it only depends on your own code if it's safe to free the GIL or not. > And while we are at it :-) Is "PyArg_Parse('[syz]*'..." the only way to > get a locked buffer-view from string/byte objects? What kind of locking do you need? Stefan -- http://mail.python.org/mailman/listinfo/python-list