summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-05-24 15:22:02 (GMT)
committerGitHub <noreply@github.com>2021-05-24 15:22:02 (GMT)
commitaf5d497f72ceaf3f207a8aded028607c4c46a993 (patch)
treec5a644695dee33c16dd30b4e31665ffde445cb86 /Python/pystate.c
parent3ad101b3175c102e252161a1b8b928e694de8c94 (diff)
downloadcpython-af5d497f72ceaf3f207a8aded028607c4c46a993.zip
cpython-af5d497f72ceaf3f207a8aded028607c4c46a993.tar.gz
cpython-af5d497f72ceaf3f207a8aded028607c4c46a993.tar.bz2
bpo-44032: Delay deletion of stack chunks until thread state is deleted. (GH-26285)
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 36057ee..64dcd57 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -897,13 +897,6 @@ PyThreadState_Clear(PyThreadState *tstate)
if (tstate->on_delete != NULL) {
tstate->on_delete(tstate->on_delete_data);
}
- _PyStackChunk *chunk = tstate->datastack_chunk;
- tstate->datastack_chunk = NULL;
- while (chunk != NULL) {
- _PyStackChunk *prev = chunk->previous;
- _PyObject_VirtualFree(chunk, chunk->size);
- chunk = prev;
- }
}
@@ -936,6 +929,13 @@ tstate_delete_common(PyThreadState *tstate,
{
PyThread_tss_set(&gilstate->autoTSSkey, NULL);
}
+ _PyStackChunk *chunk = tstate->datastack_chunk;
+ tstate->datastack_chunk = NULL;
+ while (chunk != NULL) {
+ _PyStackChunk *prev = chunk->previous;
+ _PyObject_VirtualFree(chunk, chunk->size);
+ chunk = prev;
+ }
}
static void