From 69ac6e58fd98de339c013fe64cd1cf763e4f9bca Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 4 Jun 2020 23:38:36 +0200 Subject: bpo-40521: Make tuple free list per-interpreter (GH-20247) Each interpreter now has its own tuple free lists: * Move tuple numfree and free_list arrays into PyInterpreterState. * Define PyTuple_MAXSAVESIZE and PyTuple_MAXFREELIST macros in pycore_interp.h. * Add _Py_tuple_state structure. Pass it explicitly to tuple_alloc(). * Add tstate parameter to _PyTuple_ClearFreeList() * Each interpreter now has its own empty tuple singleton. --- Modules/gcmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Modules/gcmodule.c') diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index a44752b1cc..1f5aa936e4 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1025,8 +1025,9 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate, static void clear_freelists(void) { + PyThreadState *tstate = _PyThreadState_GET(); _PyFrame_ClearFreeList(); - _PyTuple_ClearFreeList(); + _PyTuple_ClearFreeList(tstate); _PyFloat_ClearFreeList(); _PyList_ClearFreeList(); _PyDict_ClearFreeList(); -- cgit v1.2.1