mirror of
https://github.com/python/cpython
synced 2026-09-29 09:55:31 +03:00
gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (#112428)
This commit is contained in:
parent
a65a3d4806
commit
bfb576ee23
4 changed files with 20 additions and 1 deletions
|
|
@ -732,7 +732,7 @@ _gen_getframe(PyGenObject *gen, const char *const name)
|
|||
if (PySys_Audit("object.__getattr__", "Os", gen, name) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (gen->gi_frame_state == FRAME_CLEARED) {
|
||||
if (FRAME_STATE_FINISHED(gen->gi_frame_state)) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
return _Py_XNewRef((PyObject *)_PyFrame_GetFrameObject((_PyInterpreterFrame *)gen->gi_iframe));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue