ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)

This commit is contained in:
Kevin Modzelewski 2022-09-13 23:44:32 -04:00 committed by GitHub
parent f2d749a2c2
commit 4781535a57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2650,13 +2650,10 @@ handle_eval_breaker:
} }
TARGET(BUILD_TUPLE) { TARGET(BUILD_TUPLE) {
PyObject *tup = PyTuple_New(oparg); STACK_SHRINK(oparg);
PyObject *tup = _PyTuple_FromArraySteal(stack_pointer, oparg);
if (tup == NULL) if (tup == NULL)
goto error; goto error;
while (--oparg >= 0) {
PyObject *item = POP();
PyTuple_SET_ITEM(tup, oparg, item);
}
PUSH(tup); PUSH(tup);
DISPATCH(); DISPATCH();
} }