mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
GH-97779: Ensure that *all* frame objects are backed by "complete" frames (GH-97845)
This commit is contained in:
parent
c3648f4e4a
commit
0ff8fd6583
5 changed files with 75 additions and 4 deletions
|
@ -70,6 +70,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