diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-10-04 04:03:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 04:03:26 (GMT) |
commit | 4591dae421cc1415bcf982cccbf5de4f787df030 (patch) | |
tree | 1a0a960a4684c89df3af0ff577a1e37808214a12 /Python/frame.c | |
parent | 0e3a046b4849155f0c0890d18d4529a75be6a525 (diff) | |
download | cpython-4591dae421cc1415bcf982cccbf5de4f787df030.zip cpython-4591dae421cc1415bcf982cccbf5de4f787df030.tar.gz cpython-4591dae421cc1415bcf982cccbf5de4f787df030.tar.bz2 |
[3.11] GH-97752: Clear the previous member of newly-created generator/coroutine frames (GH-97812)
(cherry picked from commit 93fcc1f4133e177882850177c2c047d46019b812)
Diffstat (limited to 'Python/frame.c')
-rw-r--r-- | Python/frame.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/frame.c b/Python/frame.c index c4e9349..45072da 100644 --- a/Python/frame.c +++ b/Python/frame.c @@ -52,6 +52,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; } |