summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorKevin Modzelewski <kmod@users.noreply.github.com>2022-09-14 03:44:32 (GMT)
committerGitHub <noreply@github.com>2022-09-14 03:44:32 (GMT)
commit4781535a5796838fc4ce88e6e669e8907e426685 (patch)
tree98824a253ab3dd25261bc1a598ec2934a4a74258 /Python/ceval.c
parentf2d749a2c2188fbca97d4b542f6b6ad4f58c2c71 (diff)
downloadcpython-4781535a5796838fc4ce88e6e669e8907e426685.zip
cpython-4781535a5796838fc4ce88e6e669e8907e426685.tar.gz
cpython-4781535a5796838fc4ce88e6e669e8907e426685.tar.bz2
ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c7
1 files 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();
}