[Python-checkins] ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)
methane
webhook-mailer at python.org
Tue Sep 13 23:44:42 EDT 2022
https://github.com/python/cpython/commit/4781535a5796838fc4ce88e6e669e8907e426685
commit: 4781535a5796838fc4ce88e6e669e8907e426685
branch: main
author: Kevin Modzelewski <kmod at users.noreply.github.com>
committer: methane <songofacandy at gmail.com>
date: 2022年09月14日T12:44:32+09:00
summary:
ceval: Use _PyTuple_FromArraySteal in BUILD_TUPLE (GH-96516)
files:
M Python/ceval.c
diff --git a/Python/ceval.c b/Python/ceval.c
index 091b0eb7640..1cf72461f4c 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2650,13 +2650,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
}
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();
}
More information about the Python-checkins
mailing list