From 4781535a5796838fc4ce88e6e669e8907e426685 Mon Sep 17 00:00:00 2001 From: Kevin Modzelewski Date: Tue, 13 Sep 2022 23:44:32 -0400 Subject: ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516) --- Python/ceval.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c index 091b0eb..1cf7246 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2650,13 +2650,10 @@ handle_eval_breaker: } TARGET(BUILD_TUPLE) { - PyObject *tup = PyTuple_New(oparg); + STACK_SHRINK(oparg); + PyObject *tup = _PyTuple_FromArraySteal(stack_pointer, oparg); if (tup == NULL) goto error; - while (--oparg >= 0) { - PyObject *item = POP(); - PyTuple_SET_ITEM(tup, oparg, item); - } PUSH(tup); DISPATCH(); } -- cgit v0.12