mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
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.
This commit is contained in:
parent
74ca557e1e
commit
c55485bc6d
1 changed files with 3 additions and 4 deletions
|
|
@ -312,10 +312,9 @@ static Py_buffer * _malloc_view(PyObject *obj)
|
||||||
"Py_buffer malloc failed");
|
"Py_buffer malloc failed");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* XXX(gps): PyBUF_LOCKDATA is desired to prevent other theads from
|
/* We use PyBUF_LOCK to prevent other threads from trashing the data
|
||||||
trashing the data buffer while we release the GIL during the db
|
buffer while we release the GIL. http://bugs.python.org/issue1035 */
|
||||||
operation. see http://bugs.python.org/issue1035 */
|
if (PyObject_GetBuffer(obj, view, PyBUF_LOCK) == -1) {
|
||||||
if (PyObject_GetBuffer(obj, view, PyBUF_SIMPLE) == -1) {
|
|
||||||
PyMem_Free(view);
|
PyMem_Free(view);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue