diff --git a/Python/bytecodes.c b/Python/bytecodes.c index c5c91c06301..795c1059a86 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -886,7 +886,7 @@ dummy_func( STAT_INC(SEND, hit); if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { - Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg; diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 70a20a0f400..98358c9c9a8 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -1216,7 +1216,7 @@ STAT_INC(SEND, hit); if ((frame->owner == FRAME_OWNED_BY_GENERATOR) && (frame->f_code->co_flags & (CO_COROUTINE | CO_ASYNC_GENERATOR))) { - Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *)gen); + Ci_PyAwaitable_SetAwaiter(receiver, (PyObject *) _PyFrame_GetGenerator(frame)); } _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; frame->return_offset = oparg;