From: Kevin Modzelewski Date: Wed, 14 Sep 2022 03:44:32 +0000 (-0400) Subject: ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516) X-Git-Tag: v3.12.0a1~413 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4781535a5796838fc4ce88e6e669e8907e426685;p=thirdparty%2FPython%2Fcpython.git ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516) --- diff --git a/Python/ceval.c b/Python/ceval.c index 091b0eb76407..1cf72461f4cf 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(); }