mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
bpo-40521: Disable free lists in subinterpreters (GH-19937)
When Python is built with experimental isolated interpreters, disable tuple, dict and free free lists. Temporary workaround until these caches are made per-interpreter. Add frame_alloc() and frame_get_builtins() subfunctions to simplify _PyFrame_New_NoTrack().
This commit is contained in:
parent
ac4bf42411
commit
b4b53868d7
3 changed files with 168 additions and 86 deletions
|
@ -22,6 +22,12 @@ class tuple "PyTupleObject *" "&PyTuple_Type"
|
|||
#define PyTuple_MAXFREELIST 2000 /* Maximum number of tuples of each size to save */
|
||||
#endif
|
||||
|
||||
/* bpo-40521: tuple free lists are shared by all interpreters. */
|
||||
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
|
||||
# undef PyTuple_MAXSAVESIZE
|
||||
# define PyTuple_MAXSAVESIZE 0
|
||||
#endif
|
||||
|
||||
#if PyTuple_MAXSAVESIZE > 0
|
||||
/* Entries 1 up to PyTuple_MAXSAVESIZE are free lists, entry 0 is the empty
|
||||
tuple () of which at most one instance will be allocated.
|
||||
|
@ -248,7 +254,9 @@ tupledealloc(PyTupleObject *op)
|
|||
#endif
|
||||
}
|
||||
Py_TYPE(op)->tp_free((PyObject *)op);
|
||||
#if PyTuple_MAXSAVESIZE > 0
|
||||
done:
|
||||
#endif
|
||||
Py_TRASHCAN_END
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue