10000 ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516) · python/cpython@4781535 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4781535

Browse files
authored
ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)
1 parent f2d749a commit 4781535

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Python/ceval.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,13 +2650,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
26502650
}
26512651

26522652
TARGET(BUILD_TUPLE) {
2653-
PyObject *tup = PyTuple_New(oparg);
2653+
STACK_SHRINK(oparg);
2654+
PyObject *tup = _PyTuple_FromArraySteal(stack_pointer, oparg);
26542655
if (tup == NULL)
26552656
goto error;
2656-
while (--oparg >= 0) {
2657-
PyObject *item = POP();
2658-
PyTuple_SET_ITEM(tup, oparg, item);
2659-
}
26602657
PUSH(tup);
26612658
DISPATCH();
26622659
}

0 commit comments

Comments
 (0)
0