Skip to content

Commit b7aa23d

Browse files
authored
bpo-40521: Disable list free list in subinterpreters (GH-19959)
When Python is built with experimental isolated interpreters, disable the list free list. Temporary workaround until this cache is made per-interpreter.
1 parent d8135e9 commit b7aa23d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: Objects/listobject.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,15 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size)
9898

9999
/* Empty list reuse scheme to save calls to malloc and free */
100100
#ifndef PyList_MAXFREELIST
101-
#define PyList_MAXFREELIST 80
101+
# define PyList_MAXFREELIST 80
102102
#endif
103+
104+
/* bpo-40521: list free lists are shared by all interpreters. */
105+
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
106+
# undef PyList_MAXFREELIST
107+
# define PyList_MAXFREELIST 0
108+
#endif
109+
103110
static PyListObject *free_list[PyList_MAXFREELIST];
104111
static int numfree = 0;
105112

0 commit comments

Comments
 (0)