[Python-3000-checkins] r61457 - python/branches/py3k/Modules/_bsddb.c

gregory.p.smith python-3000-checkins at python.org
Mon Mar 17 21:16:48 CET 2008


Author: gregory.p.smith
Date: Mon Mar 17 21:16:47 2008
New Revision: 61457

Modified:
   python/branches/py3k/Modules/_bsddb.c
Log:
use PyBUF_LOCK instead of PyBUF_SIMPLE for bsddb data access as it'll often
be using the data buffer provided without the GIL held.


Modified: python/branches/py3k/Modules/_bsddb.c
==============================================================================
--- python/branches/py3k/Modules/_bsddb.c	(original)
+++ python/branches/py3k/Modules/_bsddb.c	Mon Mar 17 21:16:47 2008
@@ -312,10 +312,9 @@
                         "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;
     }


More information about the Python-3000-checkins mailing list