Skip to content

Commit

Permalink
FRAME_STATE_CLOSED --> FRAME_STATE_FINISHED
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel committed Nov 6, 2023
1 parent 6bd958c commit 1f30519
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1f30519

Please sign in to comment.