diff --git a/Objects/floatobject.c b/Objects/floatobject.c index ca95bb6fb6abaa..fadb72ffd382d3 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -2016,7 +2016,9 @@ _PyFloat_Fini(_PyFreeListState *state) // With Py_GIL_DISABLED: // See `_Py_ClearFreeLists()` about why we only need to clear the freelists // for the current thread state. +#ifndef Py_GIL_DISABLED _PyFloat_ClearFreeList(state, 1); +#endif } void diff --git a/Objects/genobject.c b/Objects/genobject.c index 94ad27a6984057..c99df3c197f49e 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1688,7 +1688,9 @@ _PyAsyncGen_Fini(_PyFreeListState *state) // With Py_GIL_DISABLED: // See `_Py_ClearFreeLists()` about why we only need to clear the freelists // for the current thread state. +#ifndef Py_GIL_DISABLED _PyAsyncGen_ClearFreeLists(state, 1); +#endif } diff --git a/Objects/listobject.c b/Objects/listobject.c index e5fb1618e71260..295abf8a1f634d 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -142,7 +142,9 @@ _PyList_Fini(_PyFreeListState *state) // With Py_GIL_DISABLED: // See `_Py_ClearFreeLists()` about why we only need to clear the freelists // for the current thread state. +#ifndef Py_GIL_DISABLED _PyList_ClearFreeList(state, 1); +#endif } /* Print summary info about the state of the optimized allocator */ diff --git a/Python/context.c b/Python/context.c index b4a9292808731b..b87fb9bb954ff8 100644 --- a/Python/context.c +++ b/Python/context.c @@ -1290,7 +1290,9 @@ _PyContext_Fini(_PyFreeListState *state) // With Py_GIL_DISABLED: // See `_Py_ClearFreeLists()` about why we only need to clear the freelists // for the current thread state. +#ifndef Py_GIL_DISABLED _PyContext_ClearFreeList(state, 1); +#endif }