summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-08-02 17:44:20 (GMT)
committerGitHub <noreply@github.com>2023-08-02 17:44:20 (GMT)
commit0d30a5a40968cce19750be78154232fae25d641f (patch)
treee6bc0cbcda38de59e6306524b247e5f6866f75be /Python
parentdd693d6320feeca887174fa592537669d017ca9b (diff)
downloadcpython-0d30a5a40968cce19750be78154232fae25d641f.zip
cpython-0d30a5a40968cce19750be78154232fae25d641f.tar.gz
cpython-0d30a5a40968cce19750be78154232fae25d641f.tar.bz2
GH-100964: Break cycles involving exception state when returning from generator (GH-107563)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 17818a0..369b9a6 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1466,6 +1466,7 @@ clear_gen_frame(PyThreadState *tstate, _PyInterpreterFrame * frame)
tstate->c_recursion_remaining--;
assert(frame->frame_obj == NULL || frame->frame_obj->f_frame == frame);
_PyFrame_ClearExceptCode(frame);
+ _PyErr_ClearExcState(&gen->gi_exc_state);
tstate->c_recursion_remaining++;
frame->previous = NULL;
}