mirror of
https://github.com/python/cpython.git
synced 2026-05-06 12:49:07 -04:00
gh-145866: Convert DICT_MERGE to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-146329)
This commit is contained in:
+6
-4
@@ -2324,7 +2324,7 @@ dummy_func(
|
||||
PyStackRef_CLOSE(update);
|
||||
}
|
||||
|
||||
inst(DICT_MERGE, (callable, unused, unused, dict, unused[oparg - 1], update -- callable, unused, unused, dict, unused[oparg - 1])) {
|
||||
op(_DICT_MERGE, (callable, unused, unused, dict, unused[oparg - 1], update -- callable, unused, unused, dict, unused[oparg - 1], u)) {
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
PyObject *dict_o = PyStackRef_AsPyObjectBorrow(dict);
|
||||
PyObject *update_o = PyStackRef_AsPyObjectBorrow(update);
|
||||
@@ -2332,12 +2332,14 @@ dummy_func(
|
||||
int err = _PyDict_MergeEx(dict_o, update_o, 2);
|
||||
if (err < 0) {
|
||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o);
|
||||
PyStackRef_CLOSE(update);
|
||||
ERROR_IF(true);
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
PyStackRef_CLOSE(update);
|
||||
u = update;
|
||||
DEAD(update);
|
||||
}
|
||||
|
||||
macro(DICT_MERGE) = _DICT_MERGE + POP_TOP;
|
||||
|
||||
inst(MAP_ADD, (dict_st, unused[oparg - 1], key, value -- dict_st, unused[oparg - 1])) {
|
||||
PyObject *dict = PyStackRef_AsPyObjectBorrow(dict_st);
|
||||
assert(PyDict_CheckExact(dict));
|
||||
|
||||
Reference in New Issue
Block a user