aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-02-10 09:57:04 +0900
committerGitHub <noreply@github.com>2024-02-10 00:57:04 +0000
commitd4d5bae1471788b345155e8e93a2fe4ab92d09dc (patch)
tree989f7efdc60aff606679d12b4f1853174dd4365d /Python/pylifecycle.c
parent564385612cdf72c2fa8e629a68225fb2cd3b3d99 (diff)
downloadcpython-d4d5bae1471788b345155e8e93a2fe4ab92d09dc.tar.gz
cpython-d4d5bae1471788b345155e8e93a2fe4ab92d09dc.zip
gh-111968: Refactor _PyXXX_Fini to integrate with _PyObject_ClearFreeLists (gh-114899)
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 0cac7109340..61c9d4f9ea9 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -1790,16 +1790,14 @@ finalize_interp_types(PyInterpreterState *interp)
// a dict internally.
_PyUnicode_ClearInterned(interp);
- _PyDict_Fini(interp);
_PyUnicode_Fini(interp);
+#ifndef Py_GIL_DISABLED
+ // With Py_GIL_DISABLED:
+ // the freelists for the current thread state have already been cleared.
_PyFreeListState *state = _PyFreeListState_GET();
- _PyTuple_Fini(state);
- _PyList_Fini(state);
- _PyFloat_Fini(state);
- _PySlice_Fini(state);
- _PyContext_Fini(state);
- _PyAsyncGen_Fini(state);
+ _PyObject_ClearFreeLists(state, 1);
+#endif
#ifdef Py_DEBUG
_PyStaticObjects_CheckRefcnt(interp);