8000 assert instead · python/cpython@eafd6b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit eafd6b1

Browse files
committed
assert instead
1 parent 084c91a commit eafd6b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/genobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,19 @@ static PyObject *
378378
gen_close(PyGenObject *gen, PyObject *args)
379379
{
380380
PyObject *retval;
381+
PyObject *yf = _PyGen_yf(gen);
381382
int err = 0;
382383

383384
if (gen->gi_frame_state == FRAME_CREATED) {
385+
assert(yf == NULL);
384386
gen->gi_frame_state = FRAME_COMPLETED;
385387
Py_RETURN_NONE;
386388
}
387389
if (gen->gi_frame_state >= FRAME_COMPLETED) {
390+
assert(yf == NULL);
388391
Py_RETURN_NONE;
389392
}
390393

391-
PyObject *yf = _PyGen_yf(gen);
392394
if (yf) {
393395
PyFrameState state = gen->gi_frame_state;
394396
gen->gi_frame_state = FRAME_EXECUTING;

0 commit comments

Comments
 (0)
0