mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
gh-116738: Add critical section to dbm/gdbm context manager (gh-140391)
This commit is contained in:
parent
a4709e525f
commit
d51be28876
2 changed files with 10 additions and 2 deletions
|
|
@ -515,8 +515,12 @@ dbm__enter__(PyObject *self, PyObject *Py_UNUSED(dummy))
|
|||
static PyObject *
|
||||
dbm__exit__(PyObject *self, PyObject *Py_UNUSED(args))
|
||||
{
|
||||
PyObject *result;
|
||||
dbmobject *dp = dbmobject_CAST(self);
|
||||
return _dbm_dbm_close_impl(dp);
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
result = _dbm_dbm_close_impl(dp);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
return result;
|
||||
}
|
||||
|
||||
static PyMethodDef dbm_methods[] = {
|
||||
|
|
|
|||
|
|
@ -690,7 +690,11 @@ gdbm__enter__(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
gdbm__exit__(PyObject *self, PyObject *args)
|
||||
{
|
||||
return _gdbm_gdbm_close_impl((gdbmobject *)self);
|
||||
PyObject *result;
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
result = _gdbm_gdbm_close_impl((gdbmobject *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
return result;
|
||||
}
|
||||
|
||||
static PyMethodDef gdbm_methods[] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue