summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c7
-rw-r--r--Python/generated_cases.c.h7
2 files changed, 4 insertions, 10 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index e1c73ab..839fac3 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1390,13 +1390,10 @@ dummy_func(
// stack effect: (__array[oparg] -- __0)
inst(BUILD_LIST) {
- PyObject *list = PyList_New(oparg);
+ STACK_SHRINK(oparg);
+ PyObject *list = _PyList_FromArraySteal(stack_pointer, oparg);
if (list == NULL)
goto error;
- while (--oparg >= 0) {
- PyObject *item = POP();
- PyList_SET_ITEM(list, oparg, item);
- }
PUSH(list);
}
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 1179bdf..ed89e90 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -1608,13 +1608,10 @@
}
TARGET(BUILD_LIST) {
- PyObject *list = PyList_New(oparg);
+ STACK_SHRINK(oparg);
+ PyObject *list = _PyList_FromArraySteal(stack_pointer, oparg);
if (list == NULL)
goto error;
- while (--oparg >= 0) {
- PyObject *item = POP();
- PyList_SET_ITEM(list, oparg, item);
- }
PUSH(list);
DISPATCH();
}