From 87af12bff33b3e7546fa26158b7d8680ecb6ecec Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 25 Feb 2022 16:22:00 +0100 Subject: [PATCH] bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583) Rename also struct _interpreter_frame to struct _PyInterpreterFrame. Reduce risk of name conflicts if a project includes pycore_frame.h. --- Include/cpython/ceval.h | 2 +- Include/cpython/pystate.h | 4 +- Include/internal/pycore_ceval.h | 4 +- Include/internal/pycore_frame.h | 58 ++++++++++----------- Modules/_tracemalloc.c | 6 +-- Modules/_xxsubinterpretersmodule.c | 2 +- Modules/signalmodule.c | 4 +- Objects/frameobject.c | 20 ++++---- Objects/genobject.c | 52 +++++++++---------- Objects/typeobject.c | 6 +-- Python/ceval.c | 82 +++++++++++++++--------------- Python/frame.c | 20 ++++---- Python/pystate.c | 8 +-- Python/sysmodule.c | 4 +- Python/traceback.c | 4 +- 15 files changed, 138 insertions(+), 138 deletions(-) diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h index aedc7367a18..5a904bd3f08 100644 --- a/Include/cpython/ceval.h +++ b/Include/cpython/ceval.h @@ -22,7 +22,7 @@ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); flag was set, else return 0. */ PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); -PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _interpreter_frame *f, int exc); +PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _PyInterpreterFrame *f, int exc); PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h index 248320cceb7..0d38604636b 100644 --- a/Include/cpython/pystate.h +++ b/Include/cpython/pystate.h @@ -46,7 +46,7 @@ typedef struct _cframe { */ int use_tracing; /* Pointer to the currently executing frame (it can be NULL) */ - struct _interpreter_frame *current_frame; + struct _PyInterpreterFrame *current_frame; struct _cframe *previous; } CFrame; @@ -258,7 +258,7 @@ PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); /* Frame evaluation API */ -typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _interpreter_frame *, int); +typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int); PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc( PyInterpreterState *interp); diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index 53d0b5c4549..70178e38650 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -47,7 +47,7 @@ extern PyObject *_PyEval_BuiltinsFromGlobals( static inline PyObject* -_PyEval_EvalFrame(PyThreadState *tstate, struct _interpreter_frame *frame, int throwflag) +_PyEval_EvalFrame(PyThreadState *tstate, struct _PyInterpreterFrame *frame, int throwflag) { if (tstate->interp->eval_frame == NULL) { return _PyEval_EvalFrameDefault(tstate, frame, throwflag); @@ -116,7 +116,7 @@ static inline void _Py_LeaveRecursiveCall_inline(void) { #define Py_LeaveRecursiveCall() _Py_LeaveRecursiveCall_inline() -struct _interpreter_frame *_PyEval_GetFrame(void); +struct _PyInterpreterFrame *_PyEval_GetFrame(void); PyObject *_Py_MakeCoro(PyFunctionObject *func); diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index f8b8e001025..20e81b7849b 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -9,7 +9,7 @@ extern "C" { struct _frame { PyObject_HEAD PyFrameObject *f_back; /* previous frame, or NULL */ - struct _interpreter_frame *f_frame; /* points to the frame data */ + struct _PyInterpreterFrame *f_frame; /* points to the frame data */ PyObject *f_trace; /* Trace function */ int f_lineno; /* Current line number. Only valid if non-zero */ char f_trace_lines; /* Emit per-line trace events? */ @@ -48,63 +48,63 @@ typedef signed char PyFrameState; unless it's -1 in which case next_instr should be first_instr. */ -typedef struct _interpreter_frame { +typedef struct _PyInterpreterFrame { PyFunctionObject *f_func; /* Strong reference */ PyObject *f_globals; /* Borrowed reference */ PyObject *f_builtins; /* Borrowed reference */ PyObject *f_locals; /* Strong reference, may be NULL */ PyCodeObject *f_code; /* Strong reference */ PyFrameObject *frame_obj; /* Strong reference, may be NULL */ - struct _interpreter_frame *previous; + struct _PyInterpreterFrame *previous; int f_lasti; /* Last instruction if called */ int stacktop; /* Offset of TOS from localsplus */ PyFrameState f_state; /* What state the frame is in */ bool is_entry; // Whether this is the "root" frame for the current CFrame. bool is_generator; PyObject *localsplus[1]; -} InterpreterFrame; +} _PyInterpreterFrame; -static inline int _PyFrame_IsRunnable(InterpreterFrame *f) { +static inline int _PyFrame_IsRunnable(_PyInterpreterFrame *f) { return f->f_state < FRAME_EXECUTING; } -static inline int _PyFrame_IsExecuting(InterpreterFrame *f) { +static inline int _PyFrame_IsExecuting(_PyInterpreterFrame *f) { return f->f_state == FRAME_EXECUTING; } -static inline int _PyFrameHasCompleted(InterpreterFrame *f) { +static inline int _PyFrameHasCompleted(_PyInterpreterFrame *f) { return f->f_state > FRAME_EXECUTING; } -static inline PyObject **_PyFrame_Stackbase(InterpreterFrame *f) { +static inline PyObject **_PyFrame_Stackbase(_PyInterpreterFrame *f) { return f->localsplus + f->f_code->co_nlocalsplus; } -static inline PyObject *_PyFrame_StackPeek(InterpreterFrame *f) { +static inline PyObject *_PyFrame_StackPeek(_PyInterpreterFrame *f) { assert(f->stacktop > f->f_code->co_nlocalsplus); assert(f->localsplus[f->stacktop-1] != NULL); return f->localsplus[f->stacktop-1]; } -static inline PyObject *_PyFrame_StackPop(InterpreterFrame *f) { +static inline PyObject *_PyFrame_StackPop(_PyInterpreterFrame *f) { assert(f->stacktop > f->f_code->co_nlocalsplus); f->stacktop--; return f->localsplus[f->stacktop]; } -static inline void _PyFrame_StackPush(InterpreterFrame *f, PyObject *value) { +static inline void _PyFrame_StackPush(_PyInterpreterFrame *f, PyObject *value) { f->localsplus[f->stacktop] = value; f->stacktop++; } -#define FRAME_SPECIALS_SIZE ((sizeof(InterpreterFrame)-1)/sizeof(PyObject *)) +#define FRAME_SPECIALS_SIZE ((sizeof(_PyInterpreterFrame)-1)/sizeof(PyObject *)) -void _PyFrame_Copy(InterpreterFrame *src, InterpreterFrame *dest); +void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest); /* Consumes reference to func */ static inline void _PyFrame_InitializeSpecials( - InterpreterFrame *frame, PyFunctionObject *func, + _PyInterpreterFrame *frame, PyFunctionObject *func, PyObject *locals, int nlocalsplus) { frame->f_func = func; @@ -124,19 +124,19 @@ _PyFrame_InitializeSpecials( * that precedes this frame. */ static inline PyObject** -_PyFrame_GetLocalsArray(InterpreterFrame *frame) +_PyFrame_GetLocalsArray(_PyInterpreterFrame *frame) { return frame->localsplus; } static inline PyObject** -_PyFrame_GetStackPointer(InterpreterFrame *frame) +_PyFrame_GetStackPointer(_PyInterpreterFrame *frame) { return frame->localsplus+frame->stacktop; } static inline void -_PyFrame_SetStackPointer(InterpreterFrame *frame, PyObject **stack_pointer) +_PyFrame_SetStackPointer(_PyInterpreterFrame *frame, PyObject **stack_pointer) { frame->stacktop = (int)(stack_pointer - frame->localsplus); } @@ -144,13 +144,13 @@ _PyFrame_SetStackPointer(InterpreterFrame *frame, PyObject **stack_pointer) /* For use by _PyFrame_GetFrameObject Do not call directly. */ PyFrameObject * -_PyFrame_MakeAndSetFrameObject(InterpreterFrame *frame); +_PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame); /* Gets the PyFrameObject for this frame, lazily * creating it if necessary. * Returns a borrowed referennce */ static inline PyFrameObject * -_PyFrame_GetFrameObject(InterpreterFrame *frame) +_PyFrame_GetFrameObject(_PyInterpreterFrame *frame) { PyFrameObject *res = frame->frame_obj; if (res != NULL) { @@ -160,7 +160,7 @@ _PyFrame_GetFrameObject(InterpreterFrame *frame) } /* Clears all references in the frame. - * If take is non-zero, then the InterpreterFrame frame + * If take is non-zero, then the _PyInterpreterFrame frame * may be transferred to the frame object it references * instead of being cleared. Either way * the caller no longer owns the references @@ -169,21 +169,21 @@ _PyFrame_GetFrameObject(InterpreterFrame *frame) * frames like the ones in generators and coroutines. */ void -_PyFrame_Clear(InterpreterFrame * frame); +_PyFrame_Clear(_PyInterpreterFrame * frame); int -_PyFrame_Traverse(InterpreterFrame *frame, visitproc visit, void *arg); +_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg); int -_PyFrame_FastToLocalsWithError(InterpreterFrame *frame); +_PyFrame_FastToLocalsWithError(_PyInterpreterFrame *frame); void -_PyFrame_LocalsToFast(InterpreterFrame *frame, int clear); +_PyFrame_LocalsToFast(_PyInterpreterFrame *frame, int clear); -extern InterpreterFrame * +extern _PyInterpreterFrame * _PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size); -static inline InterpreterFrame * +static inline _PyInterpreterFrame * _PyThreadState_BumpFramePointer(PyThreadState *tstate, size_t size) { PyObject **base = tstate->datastack_top; @@ -192,16 +192,16 @@ _PyThreadState_BumpFramePointer(PyThreadState *tstate, size_t size) assert(tstate->datastack_limit); if (top < tstate->datastack_limit) { tstate->datastack_top = top; - return (InterpreterFrame *)base; + return (_PyInterpreterFrame *)base; } } return _PyThreadState_BumpFramePointerSlow(tstate, size); } -void _PyThreadState_PopFrame(PyThreadState *tstate, InterpreterFrame *frame); +void _PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame *frame); /* Consume reference to func */ -InterpreterFrame * +_PyInterpreterFrame * _PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func); #ifdef __cplusplus diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 53e329989ab..738d54530c9 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -305,7 +305,7 @@ hashtable_compare_traceback(const void *key1, const void *key2) static void -tracemalloc_get_frame(InterpreterFrame *pyframe, frame_t *frame) +tracemalloc_get_frame(_PyInterpreterFrame *pyframe, frame_t *frame) { frame->filename = &_Py_STR(anon_unknown); int lineno = PyCode_Addr2Line(pyframe->f_code, pyframe->f_lasti*sizeof(_Py_CODEUNIT)); @@ -399,7 +399,7 @@ traceback_get_frames(traceback_t *traceback) return; } - InterpreterFrame *pyframe = tstate->cframe->current_frame; + _PyInterpreterFrame *pyframe = tstate->cframe->current_frame; for (; pyframe != NULL;) { if (traceback->nframe < _Py_tracemalloc_config.max_nframe) { tracemalloc_get_frame(pyframe, &traceback->frames[traceback->nframe]); @@ -410,7 +410,7 @@ traceback_get_frames(traceback_t *traceback) traceback->total_nframe++; } - InterpreterFrame *back = pyframe->previous; + _PyInterpreterFrame *back = pyframe->previous; pyframe = back; } } diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 1507abf3114..846b24d5efa 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -1839,7 +1839,7 @@ _is_running(PyInterpreterState *interp) } assert(!PyErr_Occurred()); - InterpreterFrame *frame = tstate->cframe->current_frame; + _PyInterpreterFrame *frame = tstate->cframe->current_frame; if (frame == NULL) { return 0; } diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 4d2ca577641..26a1f48470e 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -8,7 +8,7 @@ #include "pycore_call.h" // _PyObject_Call() #include "pycore_ceval.h" // _PyEval_SignalReceived() #include "pycore_fileutils.h" // _Py_BEGIN_SUPPRESS_IPH -#include "pycore_frame.h" // InterpreterFrame +#include "pycore_frame.h" // _PyInterpreterFrame #include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_pyerrors.h" // _PyErr_SetString() #include "pycore_pylifecycle.h" // NSIG @@ -1809,7 +1809,7 @@ _PyErr_CheckSignalsTstate(PyThreadState *tstate) */ _Py_atomic_store(&is_tripped, 0); - InterpreterFrame *frame = tstate->cframe->current_frame; + _PyInterpreterFrame *frame = tstate->cframe->current_frame; signal_state_t *state = &signal_global_state; for (int i = 1; i < NSIG; i++) { if (!_Py_atomic_load_relaxed(&Handlers[i].tripped)) { diff --git a/Objects/frameobject.c b/Objects/frameobject.c index c9445e3bb36..eb7fdb30cd7 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -629,8 +629,8 @@ frame_dealloc(PyFrameObject *f) /* Kill all local variables including specials, if we own them */ if (f->f_owns_frame) { f->f_owns_frame = 0; - assert(f->f_frame == (InterpreterFrame *)f->_f_frame_data); - InterpreterFrame *frame = (InterpreterFrame *)f->_f_frame_data; + assert(f->f_frame == (_PyInterpreterFrame *)f->_f_frame_data); + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)f->_f_frame_data; /* Don't clear code object until the end */ co = frame->f_code; frame->f_code = NULL; @@ -707,7 +707,7 @@ static PyObject * frame_sizeof(PyFrameObject *f, PyObject *Py_UNUSED(ignored)) { Py_ssize_t res; - res = offsetof(PyFrameObject, _f_frame_data) + offsetof(InterpreterFrame, localsplus); + res = offsetof(PyFrameObject, _f_frame_data) + offsetof(_PyInterpreterFrame, localsplus); PyCodeObject *code = f->f_frame->f_code; res += (code->co_nlocalsplus+code->co_stacksize) * sizeof(PyObject *); return PyLong_FromSsize_t(res); @@ -738,7 +738,7 @@ PyTypeObject PyFrame_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "frame", offsetof(PyFrameObject, _f_frame_data) + - offsetof(InterpreterFrame, localsplus), + offsetof(_PyInterpreterFrame, localsplus), sizeof(PyObject *), (destructor)frame_dealloc, /* tp_dealloc */ 0, /* tp_vectorcall_offset */ @@ -771,7 +771,7 @@ PyTypeObject PyFrame_Type = { }; static void -init_frame(InterpreterFrame *frame, PyFunctionObject *func, PyObject *locals) +init_frame(_PyInterpreterFrame *frame, PyFunctionObject *func, PyObject *locals) { /* _PyFrame_InitializeSpecials consumes reference to func */ Py_INCREF(func); @@ -827,8 +827,8 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, Py_DECREF(func); return NULL; } - init_frame((InterpreterFrame *)f->_f_frame_data, func, locals); - f->f_frame = (InterpreterFrame *)f->_f_frame_data; + init_frame((_PyInterpreterFrame *)f->_f_frame_data, func, locals); + f->f_frame = (_PyInterpreterFrame *)f->_f_frame_data; f->f_owns_frame = 1; Py_DECREF(func); _PyObject_GC_TRACK(f); @@ -836,7 +836,7 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, } static int -_PyFrame_OpAlreadyRan(InterpreterFrame *frame, int opcode, int oparg) +_PyFrame_OpAlreadyRan(_PyInterpreterFrame *frame, int opcode, int oparg) { const _Py_CODEUNIT *code = (const _Py_CODEUNIT *)PyBytes_AS_STRING(frame->f_code->co_code); @@ -849,7 +849,7 @@ _PyFrame_OpAlreadyRan(InterpreterFrame *frame, int opcode, int oparg) } int -_PyFrame_FastToLocalsWithError(InterpreterFrame *frame) { +_PyFrame_FastToLocalsWithError(_PyInterpreterFrame *frame) { /* Merge fast locals into f->f_locals */ PyObject *locals; PyObject **fast; @@ -960,7 +960,7 @@ PyFrame_FastToLocals(PyFrameObject *f) } void -_PyFrame_LocalsToFast(InterpreterFrame *frame, int clear) +_PyFrame_LocalsToFast(_PyInterpreterFrame *frame, int clear) { /* Merge locals into fast locals */ PyObject *locals; diff --git a/Objects/genobject.c b/Objects/genobject.c index b34931a95a6..bfa1ea5c45f 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -7,7 +7,7 @@ #include "pycore_object.h" // _PyObject_GC_UNTRACK() #include "pycore_pyerrors.h" // _PyErr_ClearExcState() #include "pycore_pystate.h" // _PyThreadState_GET() -#include "pycore_frame.h" // InterpreterFrame +#include "pycore_frame.h" // _PyInterpreterFrame #include "frameobject.h" // PyFrameObject #include "structmember.h" // PyMemberDef #include "opcode.h" // SEND @@ -36,7 +36,7 @@ gen_traverse(PyGenObject *gen, visitproc visit, void *arg) Py_VISIT(gen->gi_name); Py_VISIT(gen->gi_qualname); if (gen->gi_frame_valid) { - InterpreterFrame *frame = (InterpreterFrame *)(gen->gi_iframe); + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)(gen->gi_iframe); assert(frame->frame_obj == NULL || frame->frame_obj->f_owns_frame == 0); int err = _PyFrame_Traverse(frame, visit, arg); if (err) { @@ -55,7 +55,7 @@ _PyGen_Finalize(PyObject *self) PyObject *res = NULL; PyObject *error_type, *error_value, *error_traceback; - if (gen->gi_frame_valid == 0 || _PyFrameHasCompleted((InterpreterFrame *)gen->gi_iframe)) { + if (gen->gi_frame_valid == 0 || _PyFrameHasCompleted((_PyInterpreterFrame *)gen->gi_iframe)) { /* Generator isn't paused, so no need to close */ return; } @@ -87,7 +87,7 @@ _PyGen_Finalize(PyObject *self) issue a RuntimeWarning. */ if (gen->gi_code != NULL && ((PyCodeObject *)gen->gi_code)->co_flags & CO_COROUTINE && - ((InterpreterFrame *)gen->gi_iframe)->f_state == FRAME_CREATED) + ((_PyInterpreterFrame *)gen->gi_iframe)->f_state == FRAME_CREATED) { _PyErr_WarnUnawaitedCoroutine((PyObject *)gen); } @@ -131,7 +131,7 @@ gen_dealloc(PyGenObject *gen) Py_CLEAR(((PyAsyncGenObject*)gen)->ag_origin_or_finalizer); } if (gen->gi_frame_valid) { - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; gen->gi_frame_valid = 0; frame->is_generator = false; frame->previous = NULL; @@ -152,7 +152,7 @@ gen_send_ex2(PyGenObject *gen, PyObject *arg, PyObject **presult, int exc, int closing) { PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; PyObject *result; *presult = NULL; @@ -348,7 +348,7 @@ _PyGen_yf(PyGenObject *gen) PyObject *yf = NULL; if (gen->gi_frame_valid) { - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; PyObject *bytecode = gen->gi_code->co_code; unsigned char *code = (unsigned char *)PyBytes_AS_STRING(bytecode); @@ -377,7 +377,7 @@ gen_close(PyGenObject *gen, PyObject *args) int err = 0; if (yf) { - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; PyFrameState state = frame->f_state; frame->f_state = FRAME_EXECUTING; err = gen_close_iter(yf); @@ -418,7 +418,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, PyObject *yf = _PyGen_yf(gen); if (yf) { - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; PyObject *ret; int err; if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && @@ -445,7 +445,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, will be reported correctly to the user. */ /* XXX We should probably be updating the current frame somewhere in ceval.c. */ - InterpreterFrame *prev = tstate->cframe->current_frame; + _PyInterpreterFrame *prev = tstate->cframe->current_frame; frame->previous = prev; tstate->cframe->current_frame = frame; /* Close the generator that we are currently iterating with @@ -479,7 +479,7 @@ _gen_throw(PyGenObject *gen, int close_on_genexit, PyObject *val; /* Pop subiterator from stack */ assert(gen->gi_frame_valid); - ret = _PyFrame_StackPop((InterpreterFrame *)gen->gi_iframe); + ret = _PyFrame_StackPop((_PyInterpreterFrame *)gen->gi_iframe); assert(ret == yf); Py_DECREF(ret); /* Termination repetition of SEND loop */ @@ -750,7 +750,7 @@ gen_getrunning(PyGenObject *gen, void *Py_UNUSED(ignored)) if (gen->gi_frame_valid == 0) { Py_RETURN_FALSE; } - return PyBool_FromLong(_PyFrame_IsExecuting((InterpreterFrame *)gen->gi_iframe)); + return PyBool_FromLong(_PyFrame_IsExecuting((_PyInterpreterFrame *)gen->gi_iframe)); } static PyObject * @@ -759,7 +759,7 @@ gen_getsuspended(PyGenObject *gen, void *Py_UNUSED(ignored)) if (gen->gi_frame_valid == 0) { Py_RETURN_FALSE; } - return PyBool_FromLong(((InterpreterFrame *)gen->gi_iframe)->f_state == FRAME_SUSPENDED); + return PyBool_FromLong(((_PyInterpreterFrame *)gen->gi_iframe)->f_state == FRAME_SUSPENDED); } static PyObject * @@ -771,7 +771,7 @@ _gen_getframe(PyGenObject *gen, const char *const name) if (gen->gi_frame_valid == 0) { Py_RETURN_NONE; } - return _Py_XNewRef((PyObject *)_PyFrame_GetFrameObject((InterpreterFrame *)gen->gi_iframe)); + return _Py_XNewRef((PyObject *)_PyFrame_GetFrameObject((_PyInterpreterFrame *)gen->gi_iframe)); } static PyObject * @@ -802,7 +802,7 @@ static PyObject * gen_sizeof(PyGenObject *gen, PyObject *Py_UNUSED(ignored)) { Py_ssize_t res; - res = offsetof(PyGenObject, gi_iframe) + offsetof(InterpreterFrame, localsplus); + res = offsetof(PyGenObject, gi_iframe) + offsetof(_PyInterpreterFrame, localsplus); PyCodeObject *code = gen->gi_code; res += (code->co_nlocalsplus+code->co_stacksize) * sizeof(PyObject *); return PyLong_FromSsize_t(res); @@ -831,7 +831,7 @@ PyTypeObject PyGen_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "generator", /* tp_name */ offsetof(PyGenObject, gi_iframe) + - offsetof(InterpreterFrame, localsplus), /* tp_basicsize */ + offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */ sizeof(PyObject *), /* tp_itemsize */ /* methods */ (destructor)gen_dealloc, /* tp_dealloc */ @@ -905,7 +905,7 @@ make_gen(PyTypeObject *type, PyFunctionObject *func) } static PyObject * -compute_cr_origin(int origin_depth, InterpreterFrame *current_frame); +compute_cr_origin(int origin_depth, _PyInterpreterFrame *current_frame); PyObject * _Py_MakeCoro(PyFunctionObject *func) @@ -964,8 +964,8 @@ gen_new_with_qualname(PyTypeObject *type, PyFrameObject *f, /* Copy the frame */ assert(f->f_frame->frame_obj == NULL); assert(f->f_owns_frame); - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; - _PyFrame_Copy((InterpreterFrame *)f->_f_frame_data, frame); + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; + _PyFrame_Copy((_PyInterpreterFrame *)f->_f_frame_data, frame); gen->gi_frame_valid = 1; assert(frame->frame_obj == f); f->f_owns_frame = 0; @@ -1108,7 +1108,7 @@ cr_getsuspended(PyCoroObject *coro, void *Py_UNUSED(ignored)) if (coro->cr_frame_valid == 0) { Py_RETURN_FALSE; } - return PyBool_FromLong(((InterpreterFrame *)coro->cr_iframe)->f_state == FRAME_SUSPENDED); + return PyBool_FromLong(((_PyInterpreterFrame *)coro->cr_iframe)->f_state == FRAME_SUSPENDED); } static PyObject * @@ -1117,7 +1117,7 @@ cr_getrunning(PyCoroObject *coro, void *Py_UNUSED(ignored)) if (coro->cr_frame_valid == 0) { Py_RETURN_FALSE; } - return PyBool_FromLong(_PyFrame_IsExecuting((InterpreterFrame *)coro->cr_iframe)); + return PyBool_FromLong(_PyFrame_IsExecuting((_PyInterpreterFrame *)coro->cr_iframe)); } static PyObject * @@ -1176,7 +1176,7 @@ PyTypeObject PyCoro_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "coroutine", /* tp_name */ offsetof(PyCoroObject, cr_iframe) + - offsetof(InterpreterFrame, localsplus), /* tp_basicsize */ + offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */ sizeof(PyObject *), /* tp_itemsize */ /* methods */ (destructor)gen_dealloc, /* tp_dealloc */ @@ -1314,9 +1314,9 @@ PyTypeObject _PyCoroWrapper_Type = { }; static PyObject * -compute_cr_origin(int origin_depth, InterpreterFrame *current_frame) +compute_cr_origin(int origin_depth, _PyInterpreterFrame *current_frame) { - InterpreterFrame *frame = current_frame; + _PyInterpreterFrame *frame = current_frame; /* First count how many frames we have */ int frame_count = 0; for (; frame && frame_count < origin_depth; ++frame_count) { @@ -1567,7 +1567,7 @@ PyTypeObject PyAsyncGen_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) "async_generator", /* tp_name */ offsetof(PyAsyncGenObject, ag_iframe) + - offsetof(InterpreterFrame, localsplus), /* tp_basicsize */ + offsetof(_PyInterpreterFrame, localsplus), /* tp_basicsize */ sizeof(PyObject *), /* tp_itemsize */ /* methods */ (destructor)gen_dealloc, /* tp_dealloc */ @@ -2053,7 +2053,7 @@ static PyObject * async_gen_athrow_send(PyAsyncGenAThrow *o, PyObject *arg) { PyGenObject *gen = (PyGenObject*)o->agt_gen; - InterpreterFrame *frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *frame = (_PyInterpreterFrame *)gen->gi_iframe; PyObject *retval; if (o->agt_state == AWAITABLE_STATE_CLOSED) { diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 286261226fa..1dfeac3b9e6 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -12,7 +12,7 @@ #include "pycore_typeobject.h" // struct type_cache #include "pycore_unionobject.h" // _Py_union_type_or #include "frameobject.h" // PyFrameObject -#include "pycore_frame.h" // InterpreterFrame +#include "pycore_frame.h" // _PyInterpreterFrame #include "opcode.h" // MAKE_CELL #include "structmember.h" // PyMemberDef @@ -8933,7 +8933,7 @@ super_descr_get(PyObject *self, PyObject *obj, PyObject *type) } static int -super_init_without_args(InterpreterFrame *cframe, PyCodeObject *co, +super_init_without_args(_PyInterpreterFrame *cframe, PyCodeObject *co, PyTypeObject **type_p, PyObject **obj_p) { if (co->co_argcount == 0) { @@ -9017,7 +9017,7 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds) /* Call super(), without args -- fill in from __class__ and first local variable on the stack. */ PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *cframe = tstate->cframe->current_frame; + _PyInterpreterFrame *cframe = tstate->cframe->current_frame; if (cframe == NULL) { PyErr_SetString(PyExc_RuntimeError, "super(): no current frame"); diff --git a/Python/ceval.c b/Python/ceval.c index c09914fadca..4c0a71b036e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -59,7 +59,7 @@ static PyObject * do_call_core( #ifdef LLTRACE static int lltrace; static int prtrace(PyThreadState *, PyObject *, const char *); -static void lltrace_instruction(InterpreterFrame *frame, int opcode, int oparg) +static void lltrace_instruction(_PyInterpreterFrame *frame, int opcode, int oparg) { if (HAS_ARG(opcode)) { printf("%d: %d, %d\n", @@ -72,20 +72,20 @@ static void lltrace_instruction(InterpreterFrame *frame, int opcode, int oparg) } #endif static int call_trace(Py_tracefunc, PyObject *, - PyThreadState *, InterpreterFrame *, + PyThreadState *, _PyInterpreterFrame *, int, PyObject *); static int call_trace_protected(Py_tracefunc, PyObject *, - PyThreadState *, InterpreterFrame *, + PyThreadState *, _PyInterpreterFrame *, int, PyObject *); static void call_exc_trace(Py_tracefunc, PyObject *, - PyThreadState *, InterpreterFrame *); + PyThreadState *, _PyInterpreterFrame *); static int maybe_call_line_trace(Py_tracefunc, PyObject *, - PyThreadState *, InterpreterFrame *, int); -static void maybe_dtrace_line(InterpreterFrame *, PyTraceInfo *, int); -static void dtrace_function_entry(InterpreterFrame *); -static void dtrace_function_return(InterpreterFrame *); + PyThreadState *, _PyInterpreterFrame *, int); +static void maybe_dtrace_line(_PyInterpreterFrame *, PyTraceInfo *, int); +static void dtrace_function_entry(_PyInterpreterFrame *); +static void dtrace_function_return(_PyInterpreterFrame *); -static PyObject * import_name(PyThreadState *, InterpreterFrame *, +static PyObject * import_name(PyThreadState *, _PyInterpreterFrame *, PyObject *, PyObject *, PyObject *); static PyObject * import_from(PyThreadState *, PyObject *, PyObject *); static int import_all_from(PyThreadState *, PyObject *, PyObject *); @@ -97,12 +97,12 @@ static int check_except_star_type_valid(PyThreadState *tstate, PyObject* right); static void format_kwargs_error(PyThreadState *, PyObject *func, PyObject *kwargs); static void format_awaitable_error(PyThreadState *, PyTypeObject *, int, int); static int get_exception_handler(PyCodeObject *, int, int*, int*, int*); -static InterpreterFrame * +static _PyInterpreterFrame * _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func, PyObject *locals, PyObject* const* args, size_t argcount, PyObject *kwnames); static void -_PyEvalFrameClearAndPop(PyThreadState *tstate, InterpreterFrame *frame); +_PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame); #define NAME_ERROR_MSG \ "name '%.200s' is not defined" @@ -1509,7 +1509,7 @@ eval_frame_handle_pending(PyThreadState *tstate) static int -trace_function_entry(PyThreadState *tstate, InterpreterFrame *frame) +trace_function_entry(PyThreadState *tstate, _PyInterpreterFrame *frame) { if (tstate->c_tracefunc != NULL) { /* tstate->c_tracefunc, if defined, is a @@ -1548,7 +1548,7 @@ trace_function_entry(PyThreadState *tstate, InterpreterFrame *frame) } static int -trace_function_exit(PyThreadState *tstate, InterpreterFrame *frame, PyObject *retval) +trace_function_exit(PyThreadState *tstate, _PyInterpreterFrame *frame, PyObject *retval) { if (tstate->c_tracefunc) { if (call_trace_protected(tstate->c_tracefunc, tstate->c_traceobj, @@ -1575,10 +1575,10 @@ skip_backwards_over_extended_args(PyCodeObject *code, int offset) return offset; } -static InterpreterFrame * -pop_frame(PyThreadState *tstate, InterpreterFrame *frame) +static _PyInterpreterFrame * +pop_frame(PyThreadState *tstate, _PyInterpreterFrame *frame) { - InterpreterFrame *prev_frame = frame->previous; + _PyInterpreterFrame *prev_frame = frame->previous; _PyEvalFrameClearAndPop(tstate, frame); return prev_frame; } @@ -1599,7 +1599,7 @@ is_method(PyObject **stack_pointer, int args) { (call_shape.kwnames == NULL ? 0 : ((int)PyTuple_GET_SIZE(call_shape.kwnames))) PyObject* _Py_HOT_FUNCTION -_PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int throwflag) +_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag) { _Py_EnsureTstateNotNULL(tstate); CALL_STAT_INC(pyeval_calls); @@ -2203,7 +2203,7 @@ handle_eval_breaker: PyCodeObject *code = (PyCodeObject *)getitem->func_code; size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE; assert(code->co_argcount == 2); - InterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size); + _PyInterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size); if (new_frame == NULL) { goto error; } @@ -4644,7 +4644,7 @@ handle_eval_breaker: int code_flags = ((PyCodeObject*)PyFunction_GET_CODE(function))->co_flags; PyObject *locals = code_flags & CO_OPTIMIZED ? NULL : PyFunction_GET_GLOBALS(function); STACK_SHRINK(total_args); - InterpreterFrame *new_frame = _PyEvalFramePushAndInit( + _PyInterpreterFrame *new_frame = _PyEvalFramePushAndInit( tstate, (PyFunctionObject *)function, locals, stack_pointer, positional_args, call_shape.kwnames ); @@ -4753,7 +4753,7 @@ handle_eval_breaker: PyCodeObject *code = (PyCodeObject *)func->func_code; DEOPT_IF(code->co_argcount != argcount, CALL); STAT_INC(CALL, hit); - InterpreterFrame *new_frame = _PyFrame_Push(tstate, func); + _PyInterpreterFrame *new_frame = _PyFrame_Push(tstate, func); if (new_frame == NULL) { goto error; } @@ -4788,7 +4788,7 @@ handle_eval_breaker: int minargs = cache1->min_args; DEOPT_IF(argcount < minargs, CALL); STAT_INC(CALL, hit); - InterpreterFrame *new_frame = _PyFrame_Push(tstate, func); + _PyInterpreterFrame *new_frame = _PyFrame_Push(tstate, func); if (new_frame == NULL) { goto error; } @@ -5306,7 +5306,7 @@ handle_eval_breaker: } assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); - InterpreterFrame *gen_frame = (InterpreterFrame *)gen->gi_iframe; + _PyInterpreterFrame *gen_frame = (_PyInterpreterFrame *)gen->gi_iframe; _PyFrame_Copy(frame, gen_frame); assert(frame->frame_obj == NULL); gen->gi_frame_valid = 1; @@ -5314,7 +5314,7 @@ handle_eval_breaker: gen_frame->f_state = FRAME_CREATED; _Py_LeaveRecursiveCall(tstate); if (!frame->is_entry) { - InterpreterFrame *prev = frame->previous; + _PyInterpreterFrame *prev = frame->previous; _PyThreadState_PopFrame(tstate, frame); frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); @@ -6292,7 +6292,7 @@ fail_post_args: } /* Consumes references to func and all the args */ -static InterpreterFrame * +static _PyInterpreterFrame * _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func, PyObject *locals, PyObject* const* args, size_t argcount, PyObject *kwnames) @@ -6300,7 +6300,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func, PyCodeObject * code = (PyCodeObject *)func->func_code; size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE; CALL_STAT_INC(frames_pushed); - InterpreterFrame *frame = _PyThreadState_BumpFramePointer(tstate, size); + _PyInterpreterFrame *frame = _PyThreadState_BumpFramePointer(tstate, size); if (frame == NULL) { goto fail; } @@ -6330,7 +6330,7 @@ fail: } static void -_PyEvalFrameClearAndPop(PyThreadState *tstate, InterpreterFrame * frame) +_PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame * frame) { tstate->recursion_remaining--; assert(frame->frame_obj == NULL || frame->frame_obj->f_owns_frame == 0); @@ -6357,7 +6357,7 @@ _PyEval_Vector(PyThreadState *tstate, PyFunctionObject *func, Py_INCREF(args[i+argcount]); } } - InterpreterFrame *frame = _PyEvalFramePushAndInit( + _PyInterpreterFrame *frame = _PyEvalFramePushAndInit( tstate, func, locals, args, argcount, kwnames); if (frame == NULL) { return NULL; @@ -6726,7 +6726,7 @@ prtrace(PyThreadState *tstate, PyObject *v, const char *str) static void call_exc_trace(Py_tracefunc func, PyObject *self, PyThreadState *tstate, - InterpreterFrame *f) + _PyInterpreterFrame *f) { PyObject *type, *value, *traceback, *orig_traceback, *arg; int err; @@ -6756,7 +6756,7 @@ call_exc_trace(Py_tracefunc func, PyObject *self, static int call_trace_protected(Py_tracefunc func, PyObject *obj, - PyThreadState *tstate, InterpreterFrame *frame, + PyThreadState *tstate, _PyInterpreterFrame *frame, int what, PyObject *arg) { PyObject *type, *value, *traceback; @@ -6777,7 +6777,7 @@ call_trace_protected(Py_tracefunc func, PyObject *obj, } static void -initialize_trace_info(PyTraceInfo *trace_info, InterpreterFrame *frame) +initialize_trace_info(PyTraceInfo *trace_info, _PyInterpreterFrame *frame) { PyCodeObject *code = frame->f_code; if (trace_info->code != code) { @@ -6788,7 +6788,7 @@ initialize_trace_info(PyTraceInfo *trace_info, InterpreterFrame *frame) static int call_trace(Py_tracefunc func, PyObject *obj, - PyThreadState *tstate, InterpreterFrame *frame, + PyThreadState *tstate, _PyInterpreterFrame *frame, int what, PyObject *arg) { int result; @@ -6829,7 +6829,7 @@ _PyEval_CallTracing(PyObject *func, PyObject *args) /* See Objects/lnotab_notes.txt for a description of how tracing works. */ static int maybe_call_line_trace(Py_tracefunc func, PyObject *obj, - PyThreadState *tstate, InterpreterFrame *frame, int instr_prev) + PyThreadState *tstate, _PyInterpreterFrame *frame, int instr_prev) { int result = 0; @@ -7007,7 +7007,7 @@ _PyEval_GetAsyncGenFinalizer(void) return tstate->async_gen_finalizer; } -InterpreterFrame * +_PyInterpreterFrame * _PyEval_GetFrame(void) { PyThreadState *tstate = _PyThreadState_GET(); @@ -7031,7 +7031,7 @@ PyEval_GetFrame(void) PyObject * _PyEval_GetBuiltins(PyThreadState *tstate) { - InterpreterFrame *frame = tstate->cframe->current_frame; + _PyInterpreterFrame *frame = tstate->cframe->current_frame; if (frame != NULL) { return frame->f_builtins; } @@ -7070,7 +7070,7 @@ PyObject * PyEval_GetLocals(void) { PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *current_frame = tstate->cframe->current_frame; + _PyInterpreterFrame *current_frame = tstate->cframe->current_frame; if (current_frame == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, "frame does not exist"); return NULL; @@ -7089,7 +7089,7 @@ PyObject * PyEval_GetGlobals(void) { PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *current_frame = tstate->cframe->current_frame; + _PyInterpreterFrame *current_frame = tstate->cframe->current_frame; if (current_frame == NULL) { return NULL; } @@ -7100,7 +7100,7 @@ int PyEval_MergeCompilerFlags(PyCompilerFlags *cf) { PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *current_frame = tstate->cframe->current_frame; + _PyInterpreterFrame *current_frame = tstate->cframe->current_frame; int result = cf->cf_flags != 0; if (current_frame != NULL) { @@ -7304,7 +7304,7 @@ _PyEval_SliceIndexNotNone(PyObject *v, Py_ssize_t *pi) } static PyObject * -import_name(PyThreadState *tstate, InterpreterFrame *frame, +import_name(PyThreadState *tstate, _PyInterpreterFrame *frame, PyObject *name, PyObject *fromlist, PyObject *level) { PyObject *import_func, *res; @@ -7775,7 +7775,7 @@ _PyEval_RequestCodeExtraIndex(freefunc free) } static void -dtrace_function_entry(InterpreterFrame *frame) +dtrace_function_entry(_PyInterpreterFrame *frame) { const char *filename; const char *funcname; @@ -7790,7 +7790,7 @@ dtrace_function_entry(InterpreterFrame *frame) } static void -dtrace_function_return(InterpreterFrame *frame) +dtrace_function_return(_PyInterpreterFrame *frame) { const char *filename; const char *funcname; @@ -7806,7 +7806,7 @@ dtrace_function_return(InterpreterFrame *frame) /* DTrace equivalent of maybe_call_line_trace. */ static void -maybe_dtrace_line(InterpreterFrame *frame, +maybe_dtrace_line(_PyInterpreterFrame *frame, PyTraceInfo *trace_info, int instr_prev) { diff --git a/Python/frame.c b/Python/frame.c index 76697cfa083..20b4f81425b 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -7,7 +7,7 @@ #include "opcode.h" int -_PyFrame_Traverse(InterpreterFrame *frame, visitproc visit, void *arg) +_PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg) { Py_VISIT(frame->frame_obj); Py_VISIT(frame->f_locals); @@ -24,7 +24,7 @@ _PyFrame_Traverse(InterpreterFrame *frame, visitproc visit, void *arg) } PyFrameObject * -_PyFrame_MakeAndSetFrameObject(InterpreterFrame *frame) +_PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame) { assert(frame->frame_obj == NULL); PyObject *error_type, *error_value, *error_traceback; @@ -46,7 +46,7 @@ _PyFrame_MakeAndSetFrameObject(InterpreterFrame *frame) } void -_PyFrame_Copy(InterpreterFrame *src, InterpreterFrame *dest) +_PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest) { assert(src->stacktop >= src->f_code->co_nlocalsplus); Py_ssize_t size = ((char*)&src->localsplus[src->stacktop]) - (char *)src; @@ -55,17 +55,17 @@ _PyFrame_Copy(InterpreterFrame *src, InterpreterFrame *dest) static void -take_ownership(PyFrameObject *f, InterpreterFrame *frame) +take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame) { assert(f->f_owns_frame == 0); Py_ssize_t size = ((char*)&frame->localsplus[frame->stacktop]) - (char *)frame; - memcpy((InterpreterFrame *)f->_f_frame_data, frame, size); - frame = (InterpreterFrame *)f->_f_frame_data; + memcpy((_PyInterpreterFrame *)f->_f_frame_data, frame, size); + frame = (_PyInterpreterFrame *)f->_f_frame_data; f->f_owns_frame = 1; f->f_frame = frame; assert(f->f_back == NULL); if (frame->previous != NULL) { - /* Link PyFrameObjects.f_back and remove link through InterpreterFrame.previous */ + /* Link PyFrameObjects.f_back and remove link through _PyInterpreterFrame.previous */ PyFrameObject *back = _PyFrame_GetFrameObject(frame->previous); if (back == NULL) { /* Memory error here. */ @@ -84,7 +84,7 @@ take_ownership(PyFrameObject *f, InterpreterFrame *frame) } void -_PyFrame_Clear(InterpreterFrame *frame) +_PyFrame_Clear(_PyInterpreterFrame *frame) { /* It is the responsibility of the owning generator/coroutine * to have cleared the enclosing generator, if any. */ @@ -110,13 +110,13 @@ _PyFrame_Clear(InterpreterFrame *frame) } /* Consumes reference to func */ -InterpreterFrame * +_PyInterpreterFrame * _PyFrame_Push(PyThreadState *tstate, PyFunctionObject *func) { PyCodeObject *code = (PyCodeObject *)func->func_code; size_t size = code->co_nlocalsplus + code->co_stacksize + FRAME_SPECIALS_SIZE; CALL_STAT_INC(frames_pushed); - InterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size); + _PyInterpreterFrame *new_frame = _PyThreadState_BumpFramePointer(tstate, size); if (new_frame == NULL) { Py_DECREF(func); return NULL; diff --git a/Python/pystate.c b/Python/pystate.c index 85000016cb4..edf2f62431f 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1410,7 +1410,7 @@ _PyThread_CurrentFrames(void) for (i = runtime->interpreters.head; i != NULL; i = i->next) { PyThreadState *t; for (t = i->threads.head; t != NULL; t = t->next) { - InterpreterFrame *frame = t->cframe->current_frame; + _PyInterpreterFrame *frame = t->cframe->current_frame; if (frame == NULL) { continue; } @@ -2197,7 +2197,7 @@ push_chunk(PyThreadState *tstate, int size) return res; } -InterpreterFrame * +_PyInterpreterFrame * _PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size) { assert(size < INT_MAX/sizeof(PyObject *)); @@ -2209,11 +2209,11 @@ _PyThreadState_BumpFramePointerSlow(PyThreadState *tstate, size_t size) else { tstate->datastack_top = top; } - return (InterpreterFrame *)base; + return (_PyInterpreterFrame *)base; } void -_PyThreadState_PopFrame(PyThreadState *tstate, InterpreterFrame * frame) +_PyThreadState_PopFrame(PyThreadState *tstate, _PyInterpreterFrame * frame) { assert(tstate->datastack_chunk); PyObject **base = (PyObject **)frame; diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 342e48ed422..a97d0341ddc 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -18,7 +18,7 @@ Data members: #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _Py_RecursionLimitLowerWaterMark() #include "pycore_code.h" // _Py_QuickenedCount -#include "pycore_frame.h" // InterpreterFrame +#include "pycore_frame.h" // _PyInterpreterFrame #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() #include "pycore_namespace.h" // _PyNamespace_New() #include "pycore_object.h" // _PyObject_IS_GC() @@ -1807,7 +1807,7 @@ sys__getframe_impl(PyObject *module, int depth) /*[clinic end generated code: output=d438776c04d59804 input=c1be8a6464b11ee5]*/ { PyThreadState *tstate = _PyThreadState_GET(); - InterpreterFrame *frame = tstate->cframe->current_frame; + _PyInterpreterFrame *frame = tstate->cframe->current_frame; if (_PySys_Audit(tstate, "sys._getframe", NULL) < 0) { return NULL; diff --git a/Python/traceback.c b/Python/traceback.c index f2ae38e56c3..6a721cf9097 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -1167,7 +1167,7 @@ done: This function is signal safe. */ static void -dump_frame(int fd, InterpreterFrame *frame) +dump_frame(int fd, _PyInterpreterFrame *frame) { PyCodeObject *code = frame->f_code; PUTS(fd, " File "); @@ -1205,7 +1205,7 @@ dump_frame(int fd, InterpreterFrame *frame) static void dump_traceback(int fd, PyThreadState *tstate, int write_header) { - InterpreterFrame *frame; + _PyInterpreterFrame *frame; unsigned int depth; if (write_header) {