mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.11] GH-94262: Don't create frame objects for frames that aren't yet complete. (GH-94371) (#94482)
Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
parent
8fe0b1d8fa
commit
68f5fa6683
7 changed files with 87 additions and 13 deletions
|
@ -1784,9 +1784,17 @@ sys__getframe_impl(PyObject *module, int depth)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
while (depth > 0 && frame != NULL) {
|
||||
frame = frame->previous;
|
||||
--depth;
|
||||
if (frame != NULL) {
|
||||
while (depth > 0) {
|
||||
frame = frame->previous;
|
||||
if (frame == NULL) {
|
||||
break;
|
||||
}
|
||||
if (_PyFrame_IsIncomplete(frame)) {
|
||||
continue;
|
||||
}
|
||||
--depth;
|
||||
}
|
||||
}
|
||||
if (frame == NULL) {
|
||||
_PyErr_SetString(tstate, PyExc_ValueError,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue