Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
_PyFrame_GetComplete -> _PyFrame_GetFirstComplete
  • Loading branch information
brandtbucher committed Jan 9, 2023
commit 3c8830b0e8393c1fb6895bac08e7d181a87ca4e1
4 changes: 2 additions & 2 deletions Include/internal/pycore_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ _PyFrame_IsIncomplete(_PyInterpreterFrame *frame)
}

static inline _PyInterpreterFrame *
_PyFrame_GetComplete(_PyInterpreterFrame *frame)
_PyFrame_GetFirstComplete(_PyInterpreterFrame *frame)
{
while (frame && _PyFrame_IsIncomplete(frame)) {
frame = frame->previous;
Expand All @@ -178,7 +178,7 @@ _PyFrame_GetComplete(_PyInterpreterFrame *frame)
static inline _PyInterpreterFrame *
_PyThreadState_GetFrame(PyThreadState *tstate)
{
return _PyFrame_GetComplete(tstate->cframe->current_frame);
return _PyFrame_GetFirstComplete(tstate->cframe->current_frame);
}

/* For use by _PyFrame_GetFrameObject
Expand Down
2 changes: 1 addition & 1 deletion Modules/_tracemalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ traceback_get_frames(traceback_t *traceback)
if (traceback->total_nframe < UINT16_MAX) {
traceback->total_nframe++;
}
pyframe = _PyFrame_GetComplete(pyframe->previous);
pyframe = _PyFrame_GetFirstComplete(pyframe->previous);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ PyFrame_GetBack(PyFrameObject *frame)
PyFrameObject *back = frame->f_back;
if (back == NULL) {
_PyInterpreterFrame *prev = frame->f_frame->previous;
prev = _PyFrame_GetComplete(prev);
prev = _PyFrame_GetFirstComplete(prev);
if (prev) {
back = _PyFrame_GetFrameObject(prev);
}
Expand Down
6 changes: 3 additions & 3 deletions Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ _Py_MakeCoro(PyFunctionObject *func)
_PyInterpreterFrame *frame = tstate->cframe->current_frame;
assert(frame);
assert(_PyFrame_IsIncomplete(frame));
frame = _PyFrame_GetComplete(frame->previous);
frame = _PyFrame_GetFirstComplete(frame->previous);
PyObject *cr_origin = compute_cr_origin(origin_depth, frame);
((PyCoroObject *)coro)->cr_origin_or_finalizer = cr_origin;
if (!cr_origin) {
Expand Down Expand Up @@ -1289,7 +1289,7 @@ compute_cr_origin(int origin_depth, _PyInterpreterFrame *current_frame)
/* First count how many frames we have */
int frame_count = 0;
for (; frame && frame_count < origin_depth; ++frame_count) {
frame = _PyFrame_GetComplete(frame->previous);
frame = _PyFrame_GetFirstComplete(frame->previous);
}

/* Now collect them */
Expand All @@ -1308,7 +1308,7 @@ compute_cr_origin(int origin_depth, _PyInterpreterFrame *current_frame)
return NULL;
}
PyTuple_SET_ITEM(cr_origin, i, frameinfo);
frame = _PyFrame_GetComplete(frame->previous);
frame = _PyFrame_GetFirstComplete(frame->previous);
}

return cr_origin;
Expand Down
2 changes: 1 addition & 1 deletion Python/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
}
assert(!_PyFrame_IsIncomplete(frame));
assert(f->f_back == NULL);
_PyInterpreterFrame *prev = _PyFrame_GetComplete(frame->previous);
_PyInterpreterFrame *prev = _PyFrame_GetFirstComplete(frame->previous);
frame->previous = NULL;
if (prev) {
assert(prev->owner != FRAME_OWNED_BY_CSTACK);
Expand Down
2 changes: 1 addition & 1 deletion Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ _PyThread_CurrentFrames(void)
PyThreadState *t;
for (t = i->threads.head; t != NULL; t = t->next) {
_PyInterpreterFrame *frame = t->cframe->current_frame;
frame = _PyFrame_GetComplete(frame);
frame = _PyFrame_GetFirstComplete(frame);
if (frame == NULL) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ sys__getframe_impl(PyObject *module, int depth)

if (frame != NULL) {
while (depth > 0) {
frame = _PyFrame_GetComplete(frame->previous);
frame = _PyFrame_GetFirstComplete(frame->previous);
if (frame == NULL) {
break;
}
Expand Down