8000 bpo-44800: rename _PyInterpreterFrame to _Py_frame by ncoghlan · Pull Request #31987 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44800: rename _PyInterpreterFrame to _Py_frame #31987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename frame->_f_frame_data to frame->_f_owned_fdata
  • Loading branch information
ncoghlan committed Mar 19, 2022
commit 612a8e99d99c81d54d11e6b4448803cb2c9c4483
2 changes: 1 addition & 1 deletion Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct _frame {
char f_trace_opcodes; /* Emit per-opcode trace events? */
char f_owns_frame; /* This frame owns the frame */
/* The frame data, if this frame object owns the frame */
PyObject *_f_frame_data[1];
PyObject *_f_owned_fdata[1];
};

extern PyFrameObject* _PyFrame_New_NoTrack(PyCodeObject *code);
Expand Down
12 changes: 6 additions & 6 deletions Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_fdata == (_Py_frame *)f->_f_frame_data);
_Py_frame *frame = (_Py_frame *)f->_f_frame_data;
assert(f->f_fdata == (_Py_frame *)f->_f_owned_fdata);
_Py_frame *frame = (_Py_frame *)f->_f_owned_fdata;
/* Don't clear code object until the end */
co = frame->code;
frame->code = NULL;
Expand Down Expand Up @@ -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(_Py_frame, localsplus);
res = offsetof(PyFrameObject, _f_owned_fdata) + offsetof(_Py_frame, localsplus);
PyCodeObject *code = f->f_fdata->code;
res += (code->co_nlocalsplus+code->co_stacksize) * sizeof(PyObject *);
return PyLong_FromSsize_t(res);
Expand Down Expand Up @@ -737,7 +737,7 @@ static PyMethodDef frame_methods[] = {
PyTypeObject PyFrame_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
"frame",
offsetof(PyFrameObject, _f_frame_data) +
offsetof(PyFrameObject, _f_owned_fdata) +
offsetof(_Py_frame, localsplus),
sizeof(PyObject *),
(destructor)frame_dealloc, /* tp_dealloc */
Expand Down Expand Up @@ -827,8 +827,8 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code,
Py_DECREF(func);
return NULL;
}
init_frame((_Py_frame *)f->_f_frame_data, func, locals);
f->f_fdata = (_Py_frame *)f->_f_frame_data;
init_frame((_Py_frame *)f->_f_owned_fdata, func, locals);
f->f_fdata = (_Py_frame *)f->_f_owned_fdata;
f->f_owns_frame = 1;
Py_DECREF(func);
_PyObject_GC_TRACK(f);
Expand Down
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ gen_new_with_qualname(PyTypeObject *type, PyFrameObject *f,
assert(f->f_fdata->frame_obj == NULL);
assert(f->f_owns_frame);
_Py_frame *frame = (_Py_frame *)gen->gi_iframe;
_PyFrame_Copy((_Py_frame *)f->_f_frame_data, frame);
_PyFrame_Copy((_Py_frame *)f->_f_owned_fdata, frame);
gen->gi_frame_valid = 1;
assert(frame->frame_obj == f);
f->f_owns_frame = 0;
Expand Down
4 changes: 2 additions & 2 deletions Python/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ take_ownership(PyFrameObject *f, _Py_frame *frame)
{
assert(f->f_owns_frame == 0);
Py_ssize_t size = ((char*)&frame->localsplus[frame->stacktop]) - (char *)frame;
memcpy((_Py_frame *)f->_f_frame_data, frame, size);
frame = (_Py_frame *)f->_f_frame_data;
memcpy((_Py_frame *)f->_f_owned_fdata, frame, size);
frame = (_Py_frame *)f->_f_owned_fdata;
f->f_owns_frame = 1;
f->f_fdata = frame;
assert(f->f_back == NULL);
Expand Down
0