summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatori1995 <132636720+satori1995@users.noreply.github.com>2024-07-10 07:48:25 (GMT)
committerGitHub <noreply@github.com>2024-07-10 07:48:25 (GMT)
commit9585a1a2a251aaa15baf6579e13dd3be0cb05f1f (patch)
tree9c07548b354b718022337a0f7218e230605fa921
parentf62161837e68c1c77961435f1b954412dd5c2b65 (diff)
downloadcpython-9585a1a2a251aaa15baf6579e13dd3be0cb05f1f.zip
cpython-9585a1a2a251aaa15baf6579e13dd3be0cb05f1f.tar.gz
cpython-9585a1a2a251aaa15baf6579e13dd3be0cb05f1f.tar.bz2
GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2024-07-08-02-24-55.gh-issue-121439.jDHod3.rst1
-rw-r--r--Objects/tupleobject.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-07-08-02-24-55.gh-issue-121439.jDHod3.rst b/Misc/NEWS.d/next/Core and Builtins/2024-07-08-02-24-55.gh-issue-121439.jDHod3.rst
new file mode 100644
index 0000000..361f9fc
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-07-08-02-24-55.gh-issue-121439.jDHod3.rst
@@ -0,0 +1 @@
+Allow tuples of length 20 in the freelist to be reused.
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 994258f..3704d09 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -1153,7 +1153,7 @@ maybe_freelist_pop(Py_ssize_t size)
return NULL;
}
assert(size > 0);
- if (size < PyTuple_MAXSAVESIZE) {
+ if (size <= PyTuple_MAXSAVESIZE) {
Py_ssize_t index = size - 1;
PyTupleObject *op = TUPLE_FREELIST.items[index];
if (op != NULL) {