summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-01-15 15:38:57 (GMT)
committerGitHub <noreply@github.com>2024-01-15 15:38:57 (GMT)
commit3eae76554b0687c6b9c5c019cc53bb76430488c9 (patch)
treef57ef0919140b9603434f854b40054150c18f54f /Python
parent44e47dfba55a825ce7c340b1460cb493165353c9 (diff)
downloadcpython-3eae76554b0687c6b9c5c019cc53bb76430488c9.zip
cpython-3eae76554b0687c6b9c5c019cc53bb76430488c9.tar.gz
cpython-3eae76554b0687c6b9c5c019cc53bb76430488c9.tar.bz2
gh-111968: Use per-thread slice_cache in free-threading (gh-113972)
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c4
-rw-r--r--Python/pystate.c1
2 files changed, 2 insertions, 3 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 4198f6a..c33892a 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1752,15 +1752,13 @@ finalize_interp_types(PyInterpreterState *interp)
_PyUnicode_ClearInterned(interp);
_PyDict_Fini(interp);
-
- _PySlice_Fini(interp);
-
_PyUnicode_Fini(interp);
_PyFreeListState *state = _PyFreeListState_GET();
_PyTuple_Fini(state);
_PyList_Fini(state);
_PyFloat_Fini(state);
+ _PySlice_Fini(state);
#ifdef Py_DEBUG
_PyStaticObjects_CheckRefcnt(interp);
diff --git a/Python/pystate.c b/Python/pystate.c
index eaf77b0..01dc86f 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1549,6 +1549,7 @@ PyThreadState_Clear(PyThreadState *tstate)
// Each thread should clear own freelists in free-threading builds.
_PyFreeListState *freelist_state = &((_PyThreadStateImpl*)tstate)->freelist_state;
_Py_ClearFreeLists(freelist_state, 0);
+ _PySlice_ClearCache(freelist_state);
#endif
_PyThreadState_ClearMimallocHeaps(tstate);