mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
GH-95818: Skip incomplete frames in PyThreadState_GetFrame
(GH-95886) (#95890)
(cherry picked from commit 1b46d118e6
)
Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
4abf84602f
commit
6fc90c1183
3 changed files with 29 additions and 2 deletions
|
@ -1255,10 +1255,14 @@ PyFrameObject*
|
|||
PyThreadState_GetFrame(PyThreadState *tstate)
|
||||
{
|
||||
assert(tstate != NULL);
|
||||
if (tstate->cframe->current_frame == NULL) {
|
||||
_PyInterpreterFrame *f = tstate->cframe->current_frame;
|
||||
while (f && _PyFrame_IsIncomplete(f)) {
|
||||
f = f->previous;
|
||||
}
|
||||
if (f == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
PyFrameObject *frame = _PyFrame_GetFrameObject(tstate->cframe->current_frame);
|
||||
PyFrameObject *frame = _PyFrame_GetFrameObject(f);
|
||||
if (frame == NULL) {
|
||||
PyErr_Clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue