gh-143939: Fix assignment to `_PyThreadStateImpl.generator_return_kind` by colesbury · Pull Request #143951 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Lib/test/test_coroutines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix erroneous "cannot reuse already awaited coroutine" error that could
occur when a generator was run during the process of clearing a coroutine's
frame.
3 changes: 3 additions & 0 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult, int exc)

if (return_kind == GENERATOR_YIELD) {
assert(result != NULL && !_PyErr_Occurred(tstate));
#ifndef Py_GIL_DISABLED
assert(FRAME_STATE_SUSPENDED(gen->gi_frame_state));
#endif
*presult = result;
return PYGEN_NEXT;
}
Expand Down
4 changes: 3 additions & 1 deletion Python/ceval.c
Loading