Skip to content

Commit 6e45597

Browse files
committed
Rename to gen_getframe_lock_held
1 parent afbb669 commit 6e45597

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Objects/genobject.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ gen_getsuspended_get_impl(PyGenObject *self)
825825
}
826826

827827
static PyObject *
828-
_gen_getframe(PyGenObject *self, const char *name)
828+
gen_getframe_lock_held(PyGenObject *self, const char *name)
829829
{
830830
PyGenObject *gen = _PyGen_CAST(self);
831831
if (PySys_Audit("object.__getattr__", "Os", gen, name) < 0) {
@@ -843,7 +843,7 @@ gen_getframe(PyObject *self, void *Py_UNUSED(ignored))
843843
PyGenObject *gen = _PyGen_CAST(self);
844844
PyObject *res;
845845
Py_BEGIN_CRITICAL_SECTION(gen);
846-
res = _gen_getframe(gen, "gi_frame");
846+
res = gen_getframe_lock_held(gen, "gi_frame");
847847
Py_END_CRITICAL_SECTION();
848848
return res;
849849
}
@@ -1210,7 +1210,11 @@ cr_getrunning(PyObject *self, void *Py_UNUSED(ignored))
12101210
static PyObject *
12111211
cr_getframe(PyObject *coro, void *Py_UNUSED(ignored))
12121212
{
1213-
return _gen_getframe(_PyGen_CAST(coro), "cr_frame");
1213+
PyObject *res;
1214+
Py_BEGIN_CRITICAL_SECTION(coro);
1215+
res = gen_getframe_lock_held(_PyGen_CAST(coro), "cr_frame");
1216+
Py_END_CRITICAL_SECTION();
1217+
return res;
12141218
}
12151219

12161220
static PyObject *
@@ -1632,7 +1636,11 @@ async_gen_athrow(PyAsyncGenObject *o, PyObject *args)
16321636
static PyObject *
16331637
ag_getframe(PyObject *ag, void *Py_UNUSED(ignored))
16341638
{
1635-
return _gen_getframe((PyGenObject *)ag, "ag_frame");
1639+
PyObject *res;
1640+
Py_BEGIN_CRITICAL_SECTION(ag);
1641+
res = gen_getframe_lock_held((PyGenObject *)ag, "ag_frame");
1642+
Py_END_CRITICAL_SECTION();
1643+
return res;
16361644
}
16371645

16381646
static PyObject *

0 commit comments

Comments
 (0)