mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-116738: Add critical section to dbm/gdbm context manager (gh-140391) (gh-140459)
(cherry picked from commit d51be28876)
Co-authored-by: Alper <alperyoney@fb.com>
This commit is contained in:
parent
9d547dab0b
commit
01b52ea5c0
2 changed files with 10 additions and 2 deletions
|
|
@ -523,8 +523,12 @@ dbm__enter__(PyObject *self, PyObject *Py_UNUSED(dummy))
|
||||||
static PyObject *
|
static PyObject *
|
||||||
dbm__exit__(PyObject *self, PyObject *Py_UNUSED(args))
|
dbm__exit__(PyObject *self, PyObject *Py_UNUSED(args))
|
||||||
{
|
{
|
||||||
|
PyObject *result;
|
||||||
dbmobject *dp = dbmobject_CAST(self);
|
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[] = {
|
static PyMethodDef dbm_methods[] = {
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,11 @@ gdbm__enter__(PyObject *self, PyObject *args)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
gdbm__exit__(PyObject *self, PyObject *args)
|
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[] = {
|
static PyMethodDef gdbm_methods[] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue