gh-111968: Use per-thread slice_cache in free-threading (gh-113972)

This commit is contained in:
Donghee Na 2024-01-16 00:38:57 +09:00 committed by GitHub
parent 44e47dfba5
commit 3eae76554b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 18 deletions

View file

@ -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);

View file

@ -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);