@@ -98,8 +98,15 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size)
|
98 | 98 | |
99 | 99 | /* Empty list reuse scheme to save calls to malloc and free */ |
100 | 100 | #ifndef PyList_MAXFREELIST |
101 | | -#define PyList_MAXFREELIST 80 |
| 101 | +# define PyList_MAXFREELIST 80 |
102 | 102 | #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 | + |
103 | 110 | static PyListObject *free_list[PyList_MAXFREELIST]; |
104 | 111 | static int numfree = 0; |
105 | 112 | |
|