summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c55
1 files changed, 19 insertions, 36 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 528ad7f..673b401 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2801,49 +2801,32 @@ main_loop:
DISPATCH();
}
- case TARGET(BUILD_MAP_UNPACK): {
- Py_ssize_t i;
- PyObject *sum = PyDict_New();
- if (sum == NULL)
- goto error;
-
- for (i = oparg; i > 0; i--) {
- PyObject *arg = PEEK(i);
- if (PyDict_Update(sum, arg) < 0) {
- if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
- _PyErr_Format(tstate, PyExc_TypeError,
- "'%.200s' object is not a mapping",
- arg->ob_type->tp_name);
- }
- Py_DECREF(sum);
- goto error;
+ case TARGET(DICT_UPDATE): {
+ PyObject *update = POP();
+ PyObject *dict = PEEK(oparg);
+ if (PyDict_Update(dict, update) < 0) {
+ if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) {
+ _PyErr_Format(tstate, PyExc_TypeError,
+ "'%.200s' object is not a mapping",
+ update->ob_type->tp_name);
}
+ Py_DECREF(update);
+ goto error;
}
-
- while (oparg--)
- Py_DECREF(POP());
- PUSH(sum);
+ Py_DECREF(update);
DISPATCH();
}
- case TARGET(BUILD_MAP_UNPACK_WITH_CALL): {
- Py_ssize_t i;
- PyObject *sum = PyDict_New();
- if (sum == NULL)
- goto error;
+ case TARGET(DICT_MERGE): {
+ PyObject *update = POP();
+ PyObject *dict = PEEK(oparg);
- for (i = oparg; i > 0; i--) {
- PyObject *arg = PEEK(i);
- if (_PyDict_MergeEx(sum, arg, 2) < 0) {
- Py_DECREF(sum);
- format_kwargs_error(tstate, PEEK(2 + oparg), arg);
- goto error;
- }
+ if (_PyDict_MergeEx(dict, update, 2) < 0) {
+ format_kwargs_error(tstate, PEEK(2 + oparg), update);
+ Py_DECREF(update);
+ goto error;
}
-
- while (oparg--)
- Py_DECREF(POP());
- PUSH(sum);
+ Py_DECREF(update);
PREDICT(CALL_FUNCTION_EX);
DISPATCH();
}