From 1f305195d8a0fcf02ce6c4e08cf9421ef563b208 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Mon, 6 Nov 2023 21:55:16 +0000 Subject: [PATCH] FRAME_STATE_CLOSED --> FRAME_STATE_FINISHED --- Include/internal/pycore_frame.h | 2 +- Objects/genobject.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 21d874f16aa00e..0f9e7333cf1e1c 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -45,7 +45,7 @@ typedef enum _framestate { } PyFrameState; #define FRAME_STATE_SUSPENDED(S) ((S) == FRAME_SUSPENDED || (S) == FRAME_SUSPENDED_YIELD_FROM) -#define FRAME_STATE_CLOSED(S) ((S) >= FRAME_COMPLETED) +#define FRAME_STATE_FINISHED(S) ((S) >= FRAME_COMPLETED) enum _frameowner { FRAME_OWNED_BY_THREAD = 0, diff --git a/Objects/genobject.c b/Objects/genobject.c index ef63485a394a9c..f98aa357cd2ce1 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -65,7 +65,7 @@ _PyGen_Finalize(PyObject *self) { PyGenObject *gen = (PyGenObject *)self; - if (FRAME_STATE_CLOSED(gen->gi_frame_state)) { + if (FRAME_STATE_FINISHED(gen->gi_frame_state)) { /* Generator isn't paused, so no need to close */ return; } @@ -188,7 +188,7 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult, PyErr_SetString(PyExc_ValueError, msg); return PYGEN_ERROR; } - if (FRAME_STATE_CLOSED(gen->gi_frame_state)) { + if (FRAME_STATE_FINISHED(gen->gi_frame_state)) { if (PyCoro_CheckExact(gen) && !closing) { /* `gen` is an exhausted coroutine: raise an error, except when called from gen_close(), which should @@ -358,7 +358,7 @@ gen_close(PyGenObject *gen, PyObject *args) gen->gi_frame_state = FRAME_COMPLETED; Py_RETURN_NONE; } - if (FRAME_STATE_CLOSED(gen->gi_frame_state)) { + if (FRAME_STATE_FINISHED(gen->gi_frame_state)) { Py_RETURN_NONE; } PyObject *yf = _PyGen_yf(gen); @@ -2087,7 +2087,7 @@ async_gen_athrow_send(PyAsyncGenAThrow *o, PyObject *arg) return NULL; } - if (FRAME_STATE_CLOSED(gen->gi_frame_state)) { + if (FRAME_STATE_FINISHED(gen->gi_frame_state)) { o->agt_state = AWAITABLE_STATE_CLOSED; PyErr_SetNone(PyExc_StopIteration); return NULL;