mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
GH-96975: Skip incomplete frames in PyEval_GetFrame (GH-97003)
This commit is contained in:
parent
ec403536f1
commit
8fd2c3b75b
4 changed files with 79 additions and 3 deletions
|
@ -6520,11 +6520,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