mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
[3.11] GH-97752: Clear the previous member of newly-created generator/coroutine frames (GH-97812)
(cherry picked from commit 93fcc1f413
)
This commit is contained in:
parent
4e0fda59f1
commit
585c95df95
3 changed files with 24 additions and 0 deletions
|
@ -69,6 +69,9 @@ _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest)
|
|||
assert(src->stacktop >= src->f_code->co_nlocalsplus);
|
||||
Py_ssize_t size = ((char*)&src->localsplus[src->stacktop]) - (char *)src;
|
||||
memcpy(dest, src, size);
|
||||
// Don't leave a dangling pointer to the old frame when creating generators
|
||||
// and coroutines:
|
||||
dest->previous = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue