]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
use PyBUF_LOCK instead of PyBUF_SIMPLE for bsddb data access as it'll often
authorGregory P. Smith <greg@mad-scientist.com>
Mon, 17 Mar 2008 20:16:47 +0000 (20:16 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Mon, 17 Mar 2008 20:16:47 +0000 (20:16 +0000)
be using the data buffer provided without the GIL held.

Modules/_bsddb.c

index 52d83eca61a53ab533c2ba9862a38a0d34e7996c..02973aab2df367c9bf7dfb80bd17d1ccd80245fd 100644 (file)
@@ -312,10 +312,9 @@ static Py_buffer * _malloc_view(PyObject *obj)
                         "Py_buffer malloc failed");
         return NULL;
     }
-    /* XXX(gps): PyBUF_LOCKDATA is desired to prevent other theads from
-       trashing the data buffer while we release the GIL during the db
-       operation.  see http://bugs.python.org/issue1035 */
-    if (PyObject_GetBuffer(obj, view, PyBUF_SIMPLE) == -1) {
+    /* We use PyBUF_LOCK to prevent other threads from trashing the data
+       buffer while we release the GIL.  http://bugs.python.org/issue1035 */
+    if (PyObject_GetBuffer(obj, view, PyBUF_LOCK) == -1) {
         PyMem_Free(view);
         return NULL;
     }