mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
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.
This commit is contained in:
parent
f780d9690f
commit
87af12bff3
15 changed files with 138 additions and 138 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue