From: Gregory P. Smith Date: Mon, 17 Mar 2008 20:16:47 +0000 (+0000) Subject: use PyBUF_LOCK instead of PyBUF_SIMPLE for bsddb data access as it'll often X-Git-Tag: v3.0a4~149 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c55485bc6d4a22026e12ccc6b772984059468a86;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 52d83eca61a5..02973aab2df3 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -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; }