Skip to content

Commit d6cc59a

Browse files
committed
Rename _gen_throw to gen_throw_lock_held
1 parent ee93193 commit d6cc59a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Objects/genobject.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ the (type, val, tb) signature is deprecated, \n\
480480
and may be removed in a future version of Python.");
481481

482482
static PyObject *
483-
_gen_throw(PyGenObject *gen, int close_on_genexit,
483+
gen_throw_lock_held(PyGenObject *gen, int close_on_genexit,
484484
PyObject *typ, PyObject *val, PyObject *tb)
485485
{
486486
PyObject *yf = _PyGen_yf(gen);
@@ -520,7 +520,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
520520
'yield from' or awaiting on with 'await'. */
521521
PyFrameState state = gen->gi_frame_state;
522522
gen->gi_frame_state = FRAME_EXECUTING;
523-
ret = _gen_throw((PyGenObject *)yf, close_on_genexit,
523+
ret = gen_throw_lock_held((PyGenObject *)yf, close_on_genexit,
524524
typ, val, tb);
525525
gen->gi_frame_state = state;
526526
tstate->current_frame = prev;
@@ -640,7 +640,7 @@ gen_throw(PyGenObject *gen, PyObject *const *args, Py_ssize_t nargs)
640640
}
641641
PyObject *res;
642642
Py_BEGIN_CRITICAL_SECTION(gen);
643-
res = _gen_throw(gen, 1, typ, val, tb);
643+
res = gen_throw_lock_held(gen, 1, typ, val, tb);
644644
Py_END_CRITICAL_SECTION();
645645
return res;
646646
}
@@ -2193,12 +2193,12 @@ async_gen_athrow_send(PyObject *self, PyObject *arg)
21932193
if (o->agt_args == NULL) {
21942194
/* aclose() mode */
21952195
o->agt_gen->ag_closed = 1;
2196-
2197-
retval = _gen_throw((PyGenObject *)gen,
2196+
Py_BEGIN_CRITICAL_SECTION(gen);
2197+
retval = gen_throw_lock_held((PyGenObject *)gen,
21982198
0, /* Do not close generator when
21992199
PyExc_GeneratorExit is passed */
22002200
PyExc_GeneratorExit, NULL, NULL);
2201-
2201+
Py_END_CRITICAL_SECTION();
22022202
if (retval && _PyAsyncGenWrappedValue_CheckExact(retval)) {
22032203
Py_DECREF(retval);
22042204
goto yield_close;
@@ -2213,10 +2213,12 @@ async_gen_athrow_send(PyObject *self, PyObject *arg)
22132213
return NULL;
22142214
}
22152215

2216-
retval = _gen_throw((PyGenObject *)gen,
2216+
Py_BEGIN_CRITICAL_SECTION(gen);
2217+
retval = gen_throw_lock_held((PyGenObject *)gen,
22172218
0, /* Do not close generator when
22182219
PyExc_GeneratorExit is passed */
22192220
typ, val, tb);
2221+
Py_END_CRITICAL_SECTION();
22202222
retval = async_gen_unwrap_value(o->agt_gen, retval);
22212223
}
22222224
if (retval == NULL) {

0 commit comments

Comments
 (0)