mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
[3.11] GH-99729: Unlink frames before clearing them (#100047)
This commit is contained in:
parent
3fae04b10e
commit
2182a71eed
4 changed files with 56 additions and 10 deletions
|
|
@ -123,6 +123,9 @@ _PyFrame_Clear(_PyInterpreterFrame *frame)
|
|||
* to have cleared the enclosing generator, if any. */
|
||||
assert(frame->owner != FRAME_OWNED_BY_GENERATOR ||
|
||||
_PyFrame_GetGenerator(frame)->gi_frame_state == FRAME_CLEARED);
|
||||
// GH-99729: Clearing this frame can expose the stack (via finalizers). It's
|
||||
// crucial that this frame has been unlinked, and is no longer visible:
|
||||
assert(_PyThreadState_GET()->cframe->current_frame != frame);
|
||||
if (frame->frame_obj) {
|
||||
PyFrameObject *f = frame->frame_obj;
|
||||
frame->frame_obj = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue