diff options
author | Victor Stinner <vstinner@python.org> | 2020-05-05 17:55:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 17:55:29 (GMT) |
commit | b4b53868d7d6cd13505321d3802fd00865b25e05 (patch) | |
tree | 850dd2ad175f058b4d040bd38b5757c2149cc3b5 /Objects/tupleobject.c | |
parent | ac4bf424119d1300f57929120968e216a85d3a25 (diff) | |
download | cpython-b4b53868d7d6cd13505321d3802fd00865b25e05.zip cpython-b4b53868d7d6cd13505321d3802fd00865b25e05.tar.gz cpython-b4b53868d7d6cd13505321d3802fd00865b25e05.tar.bz2 |
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().
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index f8648d2..c0b59c0 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -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 } |