mirror of
https://github.com/python/cpython.git
synced 2025-07-17 00:05:20 +00:00
[3.11] GH-97779: Ensure that *all* frame objects are backed by "complete" frames (GH-97886)
(cherry picked from commit 0ff8fd6583
)
Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
This commit is contained in:
parent
8c517d88fb
commit
015b49ac05
5 changed files with 75 additions and 4 deletions
|
@ -68,6 +68,13 @@ take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
|
|||
frame = (_PyInterpreterFrame *)f->_f_frame_data;
|
||||
f->f_frame = frame;
|
||||
frame->owner = FRAME_OWNED_BY_FRAME_OBJECT;
|
||||
if (_PyFrame_IsIncomplete(frame)) {
|
||||
// This may be a newly-created generator or coroutine frame. Since it's
|
||||
// dead anyways, just pretend that the first RESUME ran:
|
||||
PyCodeObject *code = frame->f_code;
|
||||
frame->prev_instr = _PyCode_CODE(code) + code->_co_firsttraceable;
|
||||
}
|
||||
assert(!_PyFrame_IsIncomplete(frame));
|
||||
assert(f->f_back == NULL);
|
||||
_PyInterpreterFrame *prev = frame->previous;
|
||||
while (prev && _PyFrame_IsIncomplete(prev)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue