diff options
author | Donghee Na <donghee.na@python.org> | 2024-01-18 18:15:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-18 18:15:00 (GMT) |
commit | 7fa511ba576b9a760f3971ad16dbbbbf91c3f39c (patch) | |
tree | d3e5fa9dd914d10f6f018bc728664635419ecb32 /Python | |
parent | 2d3f6b56c5846df60b0b305e51a1d293ba0b2aae (diff) | |
download | cpython-7fa511ba576b9a760f3971ad16dbbbbf91c3f39c.zip cpython-7fa511ba576b9a760f3971ad16dbbbbf91c3f39c.tar.gz cpython-7fa511ba576b9a760f3971ad16dbbbbf91c3f39c.tar.bz2 |
gh-111968: Use per-thread freelists for generator in free-threading (gh-114189)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/gc_free_threading.c | 1 | ||||
-rw-r--r-- | Python/gc_gil.c | 1 | ||||
-rw-r--r-- | Python/pylifecycle.c | 2 | ||||
-rw-r--r-- | Python/pystate.c | 3 |
4 files changed, 3 insertions, 4 deletions
diff --git a/Python/gc_free_threading.c b/Python/gc_free_threading.c index b1511eb..207a43b 100644 --- a/Python/gc_free_threading.c +++ b/Python/gc_free_threading.c @@ -15,7 +15,6 @@ void _PyGC_ClearAllFreeLists(PyInterpreterState *interp) { _PyDict_ClearFreeList(interp); - _PyAsyncGen_ClearFreeLists(interp); HEAD_LOCK(&_PyRuntime); _PyThreadStateImpl *tstate = (_PyThreadStateImpl *)interp->threads.head; diff --git a/Python/gc_gil.c b/Python/gc_gil.c index edf8417..04c1c18 100644 --- a/Python/gc_gil.c +++ b/Python/gc_gil.c @@ -12,7 +12,6 @@ void _PyGC_ClearAllFreeLists(PyInterpreterState *interp) { _PyDict_ClearFreeList(interp); - _PyAsyncGen_ClearFreeLists(interp); _Py_ClearFreeLists(&interp->freelist_state, 0); } diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 598cd68..0d5eec0 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1735,7 +1735,6 @@ finalize_interp_types(PyInterpreterState *interp) _PySys_FiniTypes(interp); _PyXI_FiniTypes(interp); _PyExc_Fini(interp); - _PyAsyncGen_Fini(interp); _PyFloat_FiniType(interp); _PyLong_FiniTypes(interp); _PyThread_FiniType(interp); @@ -1759,6 +1758,7 @@ finalize_interp_types(PyInterpreterState *interp) _PyFloat_Fini(state); _PySlice_Fini(state); _PyContext_Fini(state); + _PyAsyncGen_Fini(state); #ifdef Py_DEBUG _PyStaticObjects_CheckRefcnt(interp); diff --git a/Python/pystate.c b/Python/pystate.c index 8374223..9999762 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1462,6 +1462,7 @@ _Py_ClearFreeLists(_PyFreeListState *state, int is_finalization) _PyTuple_ClearFreeList(state, is_finalization); _PyList_ClearFreeList(state, is_finalization); _PyContext_ClearFreeList(state, is_finalization); + _PyAsyncGen_ClearFreeLists(state, is_finalization); } void @@ -1549,7 +1550,7 @@ PyThreadState_Clear(PyThreadState *tstate) #ifdef Py_GIL_DISABLED // Each thread should clear own freelists in free-threading builds. _PyFreeListState *freelist_state = &((_PyThreadStateImpl*)tstate)->freelist_state; - _Py_ClearFreeLists(freelist_state, 0); + _Py_ClearFreeLists(freelist_state, 1); _PySlice_ClearCache(freelist_state); #endif |