Skip to content

Commit 04b77ac

Browse files
committed
Add _PyFrame_GetComplete/_PyThreadState_GetFrame
1 parent 4ff833e commit 04b77ac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Include/internal/pycore_frame.h

+15
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,21 @@ _PyFrame_IsIncomplete(_PyInterpreterFrame *frame)
153153
frame->prev_instr < _PyCode_CODE(frame->f_code) + frame->f_code->_co_firsttraceable;
154154
}
155155

156+
static inline _PyInterpreterFrame *
157+
_PyFrame_GetComplete(_PyInterpreterFrame *frame)
158+
{
159+
while (frame && _PyFrame_IsIncomplete(frame)) {
160+
frame = frame->previous;
161+
}
162+
return frame;
163+
}
164+
165+
static inline _PyInterpreterFrame *
166+
_PyThreadState_GetFrame(PyThreadState *tstate)
167+
{
168+
return _PyFrame_GetComplete(tstate->cframe->current_frame);
169+
}
170+
156171
/* For use by _PyFrame_GetFrameObject
157172
Do not call directly. */
158173
PyFrameObject *

0 commit comments

Comments
 (0)