mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97018)
(cherry picked from commit 8fd2c3b75b
)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
This commit is contained in:
parent
886fd3938b
commit
154b3cd751
4 changed files with 79 additions and 3 deletions
|
@ -7115,11 +7115,14 @@ _PyEval_GetFrame(void)
|
|||
PyFrameObject *
|
||||
PyEval_GetFrame(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
if (tstate->cframe->current_frame == NULL) {
|
||||
_PyInterpreterFrame *frame = _PyEval_GetFrame();
|
||||
while (frame && _PyFrame_IsIncomplete(frame)) {
|
||||
frame = frame->previous;
|
||||
}
|
||||
if (frame == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
PyFrameObject *f = _PyFrame_GetFrameObject(tstate->cframe->current_frame);
|
||||
PyFrameObject *f = _PyFrame_GetFrameObject(frame);
|
||||
if (f == NULL) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue