From 82c4d55c75388da9a044f4fe9aa24f0d094c5c88 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 9 Dec 2022 10:23:21 -0600 Subject: [PATCH] GH-98363: Shrink the physical size as well as the logical size --- Modules/itertoolsmodule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 60ec11c32d01e5..c1f1e7320db719 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -182,8 +182,7 @@ batched_next(batchedobject *bo) Py_DECREF(result); return NULL; } - /* Elements in result[i:] are still NULL */ - Py_SET_SIZE(result, i); + _PyTuple_Resize(&result, i); return result; }