mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
[3.11] GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613) (#96617)
(cherry picked from commit 95e271b226
)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
a0848d169b
commit
26dc4dfac3
3 changed files with 23 additions and 3 deletions
|
@ -400,7 +400,13 @@ traceback_get_frames(traceback_t *traceback)
|
|||
}
|
||||
|
||||
_PyInterpreterFrame *pyframe = tstate->cframe->current_frame;
|
||||
for (; pyframe != NULL;) {
|
||||
for (;;) {
|
||||
while (pyframe && _PyFrame_IsIncomplete(pyframe)) {
|
||||
pyframe = pyframe->previous;
|
||||
}
|
||||
if (pyframe == NULL) {
|
||||
break;
|
||||
}
|
||||
if (traceback->nframe < _Py_tracemalloc_config.max_nframe) {
|
||||
tracemalloc_get_frame(pyframe, &traceback->frames[traceback->nframe]);
|
||||
assert(traceback->frames[traceback->nframe].filename != NULL);
|
||||
|
@ -410,8 +416,7 @@ traceback_get_frames(traceback_t *traceback)
|
|||
traceback->total_nframe++;
|
||||
}
|
||||
|
||||
_PyInterpreterFrame *back = pyframe->previous;
|
||||
pyframe = back;
|
||||
pyframe = pyframe->previous;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue