8000 Rename fdata->f_state to fdata->state · python/cpython@40156aa · GitHub
[go: up one dir, main page]

Skip to content

Commit 40156aa

Browse files
committed
Rename fdata->f_state to fdata->state
1 parent d26dca8 commit 40156aa

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

Include/internal/pycore_frame.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code);
7474
/* other API */
7575

7676
/* These values are chosen so that the inline functions below all
77-
* compare f_state to zero.
77+
* compare the current frame state to zero.
7878
*/
7979
enum _framestate {
8080
FRAME_CREATED = -2,
@@ -103,22 +103,22 @@ typedef struct _Py_frame {
103103
struct _Py_frame *previous;
104104
int lasti; /* Last instruction if called */
105105
int stacktop; /* Offset of TOS from localsplus */
106-
PyFrameState f_state; /* What state the frame is in */
106+
PyFrameState state; /* What state the frame is in */
107107
bool is_entry; // Whether this is the "root" frame for the current _PyCFrame.
108108
bool is_generator;
109109
PyObject *localsplus[1];
110110
} _Py_frame;
111111

112112
static inline int _PyFrame_IsRunnable(_Py_frame *f) {
113-
return f->f_state < FRAME_EXECUTING;
113+
return f->state < FRAME_EXECUTING;
114114
}
115115

116116
static inline int _PyFrame_IsExecuting(_Py_frame *f) {
117-
return f->f_state == FRAME_EXECUTING;
117+
return f->state == FRAME_EXECUTING;
118118
}
119119

120120
static inline int _PyFrameHasCompleted(_Py_frame *f) {
121-
return f->f_state > FRAME_EXECUTING;
121+
return f->state > FRAME_EXECUTING;
122122
}
123123

124124
static inline PyObject **_PyFrame_Stackbase(_Py_frame *f) {
@@ -160,7 +160,7 @@ _PyFrame_InitializeSpecials(
160160
frame->stacktop = nlocalsplus;
161161
frame->frame_obj = NULL;
162162
frame->lasti = -1;
163-
frame->f_state = FRAME_CREATED;
163+
frame->state = FRAME_CREATED;
164164
frame->is_entry = false;
165165
frame->is_generator = false;
166166
}

Objects/frameobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
442442
* In addition, jumps are forbidden when not tracing,
443443
* as this is a debugging feature.
444444
*/
445-
switch(f->f_frame->f_state) {
445+
switch(f->f_frame->state) {
446446
case FRAME_CREATED:
447447
PyErr_Format(PyExc_ValueError,
448448
"can't jump from the 'call' trace event of a new frame");
@@ -550,7 +550,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
550550
return -1;
551551
}
552552
/* Unwind block stack. */
553-
if (f->f_frame->f_state == FRAME_SUSPENDED) {
553+
if (f->f_frame->state == FRAME_SUSPENDED) {
554554
/* Account for value popped by yield */
555555
start_stack = pop_value(start_stack);
556556
}
@@ -668,7 +668,7 @@ frame_tp_clear(PyFrameObject *f)
668668
* frame may also point to this frame, believe itself to still be
669669
* active, and try cleaning up this frame again.
670670
*/
671-
f->f_frame->f_state = FRAME_CLEARED;
671+
f->f_frame->state = FRAME_CLEARED;
672672

673673
Py_CLEAR(f->f_trace);
674674

@@ -891,7 +891,7 @@ _PyFrame_FastToLocalsWithError(_Py_frame *frame) {
891891

892892
PyObject *name = PyTuple_GET_ITEM(co->co_localsplusnames, i);
893893
PyObject *value = fast[i];
894-
if (frame->f_state != FRAME_CLEARED) {
894+
if (frame->state != FRAME_CLEARED) {
895895
if (kind & CO_FAST_FREE) {
896896
// The cell was set by COPY_FREE_VARS.
897897
assert(value != NULL && PyCell_Check(value));
@@ -1028,7 +1028,7 @@ _PyFrame_LocalsToFast(_Py_frame *frame, int clear)
10281028
void
10291029
PyFrame_LocalsToFast(PyFrameObject *f, int clear)
10301030
{
1031-
if (f == NULL || f->f_frame->f_state == FRAME_CLEARED) {
1031+
if (f == NULL || f->f_frame->state == FRAME_CLEARED) {
10321032
return;
10331033
}
10341034
_PyFrame_LocalsToFast(f->f_frame, clear);

Objects/genobject.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ _PyGen_Finalize(PyObject *self)
8787
issue a RuntimeWarning. */
8888
if (gen->gi_code != NULL &&
8989
((PyCodeObject *)gen->gi_code)->co_flags & CO_COROUTINE &&
90-
((_Py_frame *)gen->gi_iframe)->f_state == FRAME_CREATED)
90+
((_Py_frame *)gen->gi_iframe)->state == FRAME_CREATED)
9191
{
9292
_PyErr_WarnUnawaitedCoroutine((PyObject *)gen);
9393
}
@@ -156,7 +156,7 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult,
156156
PyObject *result;
157157

158158
*presult = NULL;
159-
if (frame->f_state == FRAME_CREATED && arg && arg != Py_None) {
159+
if (frame->state == FRAME_CREATED && arg && arg != Py_None) {
160160
const char *msg = "can't send non-None value to a "
161161
"just-started generator";
162162
if (PyCoro_CheckExact(gen)) {
@@ -381,10 +381,10 @@ gen_close(PyGenObject *gen, PyObject *args)
381381

382382
if (yf) {
383383
_Py_frame *frame = (_Py_frame *)gen->gi_iframe;
384-
PyFrameState state = frame->f_state;
385-
frame->f_state = FRAME_EXECUTING;
384+
PyFrameState state = frame->state;
385+
frame->state = FRAME_EXECUTING;
386386
err = gen_close_iter(yf);
387-
frame->f_state = state;
387+
frame->state = state;
388388
Py_DECREF(yf);
389389
}
390390
if (err == 0)
@@ -431,10 +431,10 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
431431
We have to allow some awaits to work it through, hence the
432432
`close_on_genexit` parameter here.
433433
*/
434-
PyFrameState state = frame->f_state;
435-
frame->f_state = FRAME_EXECUTING;
434+
PyFrameState state = frame->state;
435+
frame->state = FRAME_EXECUTING;
436436
err = gen_close_iter(yf);
437-
frame->f_state = state;
437+
frame->state = state;
438438
Py_DECREF(yf);
439439
if (err < 0)
440440
return gen_send_ex(gen, Py_None, 1, 0);
@@ -453,11 +453,11 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
453453
tstate->cframe->current_frame = frame;
454454
/* Close the generator that we are currently iterating with
455455
'yield from' or awaiting on with 'await'. */
456-
PyFrameState state = frame->f_state;
457-
frame->f_state = FRAME_EXECUTING;
456+
PyFrameState state = frame->state;
457+
frame->state = FRAME_EXECUTING;
458458
ret = _gen_throw((PyGenObject *)yf, close_on_genexit,
459459
typ, val, tb);
460-
frame->f_state = state;
460+
frame->state = state;
461461
tstate->cframe->current_frame = prev;
462462
frame->previous = NULL;
463463
} else {
@@ -471,10 +471,10 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
471471
Py_DECREF(yf);
472472
goto throw_here;
473473
}
474-
PyFrameState state = frame->f_state;
475-
frame->f_state = FRAME_EXECUTING;
474+
PyFrameState state = frame->state;
475+
frame->state = FRAME_EXECUTING;
476476
ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
477-
frame->f_state = state;
477+
frame->state = state;
478478
Py_DECREF(meth);
479479
}
480480
Py_DECREF(yf);
@@ -769,7 +769,7 @@ gen_getsuspended(PyGenObject *gen, void *Py_UNUSED(ignored))
769769
if (gen->gi_frame_valid == 0) {
770770
Py_RETURN_FALSE;
771771
}
772-
return PyBool_FromLong(((_Py_frame *)gen->gi_iframe)->f_state == FRAME_SUSPENDED);
772+
return PyBool_FromLong(((_Py_frame *)gen->gi_iframe)->state == FRAME_SUSPENDED);
773773
}
774774

775775
static PyObject *
@@ -1118,7 +1118,7 @@ cr_getsuspended(PyCoroObject *coro, void *Py_UNUSED(ignored))
11181118
if (coro->cr_frame_valid == 0) {
11191119
Py_RETURN_FALSE;
11201120
}
1121-
return PyBool_FromLong(((_Py_frame *)coro->cr_iframe)->f_state == FRAME_SUSPENDED);
1121+
return PyBool_FromLong(((_Py_frame *)coro->cr_iframe)->state == FRAME_SUSPENDED);
11221122
}
11231123

11241124
static PyObject *

Python/ceval.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
17391739
PREDICTED(RESUME_QUICK);
17401740
assert(tstate->cframe == &cframe);
17411741
assert(frame == cframe.current_frame);
1742-
frame->f_state = FRAME_EXECUTING;
1742+
frame->state = FRAME_EXECUTING;
17431743
if (_Py_atomic_load_relaxed(eval_breaker) && oparg < 2) {
17441744
goto handle_eval_breaker;
17451745
}
@@ -2382,7 +2382,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
23822382
TARGET(RETURN_VALUE) {
23832383
PyObject *retval = POP();
23842384
assert(EMPTY());
2385-
frame->f_state = FRAME_RETURNED;
2385+
frame->state = FRAME_RETURNED;
23862386
_PyFrame_SetStackPointer(frame, stack_pointer);
23872387
TRACE_FUNCTION_EXIT();
23882388
DTRACE_FUNCTION_EXIT();
@@ -2594,7 +2594,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
25942594
TARGET(YIELD_VALUE) {
25952595
assert(frame->is_entry);
25962596
PyObject *retval = POP();
2597-
frame->f_state = FRAME_SUSPENDED;
2597+
frame->state = FRAME_SUSPENDED;
25982598
_PyFrame_SetStackPointer(frame, stack_pointer);
25992599
TRACE_FUNCTION_EXIT();
26002600
DTRACE_FUNCTION_EXIT();
@@ -4086,7 +4086,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
40864086
* generator or coroutine, so we deliberately do not check it here.
40874087
* (see bpo-30039).
40884088
*/
4089-
frame->f_state = FRAME_EXECUTING;
4089+
frame->state = FRAME_EXECUTING;
40904090
JUMPTO(oparg);
40914091
DISPATCH();
40924092
}
@@ -5273,7 +5273,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
52735273
assert(frame->frame_obj == NULL);
52745274
gen->gi_frame_valid = 1;
52755275
gen_frame->is_generator = true;
5276-
gen_frame->f_state = FRAME_CREATED;
5276+
gen_frame->state = FRAME_CREATED;
52775277
_Py_LeaveRecursiveCall(tstate);
52785278
if (!frame->is_entry) {
52795279
_Py_frame *prev = frame->previous;
@@ -5454,7 +5454,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _Py_frame *frame, int throwflag)
54545454
TRACE_FUNCTION_ENTRY();
54555455
DTRACE_FUNCTION_ENTRY();
54565456
}
5457-
else if (frame->f_state > FRAME_CREATED) {
5457+
else if (frame->state > FRAME_CREATED) {
54585458
/* line-by-line tracing support */
54595459
if (PyDTrace_LINE_ENABLED()) {
54605460
maybe_dtrace_line(frame, &tstate->trace_info, instr_prev);
@@ -5575,13 +5575,13 @@ MISS_WITH_INLINE_CACHE(STORE_SUBSCR)
55755575

55765576
if (tstate->c_tracefunc != NULL) {
55775577
/* Make sure state is set to FRAME_UNWINDING for tracing */
5578-
frame->f_state = FRAME_UNWINDING;
5578+
frame->state = FRAME_UNWINDING;
55795579
call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj,
55805580
tstate, frame);
55815581
}
55825582

55835583
exception_unwind:
5584-
frame->f_state = FRAME_UNWINDING;
5584+
frame->state = FRAME_UNWINDING;
55855585
/* We can't use frame->lasti here, as RERAISE may have set it */
55865586
int offset = INSTR_OFFSET()-1;
55875587
int level, handler, lasti;
@@ -5597,7 +5597,7 @@ MISS_WITH_INLINE_CACHE(STORE_SUBSCR)
55975597
}
55985598
assert(STACK_LEVEL() == 0);
55995599
_PyFrame_SetStackPointer(frame, stack_pointer);
5600-
frame->f_state = FRAME_RAISED;
5600+
frame->state = FRAME_RAISED;
56015601
TRACE_FUNCTION_UNWIND();
56025602
DTRACE_FUNCTION_EXIT();
56035603
goto exit_unwind;
@@ -5632,7 +5632,7 @@ MISS_WITH_INLINE_CACHE(STORE_SUBSCR)
56325632
PUSH(val);
56335633
JUMPTO(handler);
56345634
/* Resume normal execution */
5635-
frame->f_state = FRAME_EXECUTING;
5635+
frame->state = FRAME_EXECUTING;
56365636
DISPATCH();
56375637
}
56385638

0 commit comments

Comments
 (0)
0