gh-145866: Convert DICT_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-146190)

This commit is contained in:
Sacul 2026-03-26 19:38:44 +08:00 committed by GitHub
parent 8de70b31c5
commit 1516c26399
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1254 additions and 1223 deletions

View file

@ -2382,7 +2382,7 @@ dummy_func(
NOP,
};
inst(DICT_UPDATE, (dict, unused[oparg - 1], update -- dict, unused[oparg - 1])) {
op(_DICT_UPDATE, (dict, unused[oparg - 1], update -- dict, unused[oparg - 1], upd)) {
PyObject *dict_o = PyStackRef_AsPyObjectBorrow(dict);
PyObject *update_o = PyStackRef_AsPyObjectBorrow(update);
@ -2394,12 +2394,14 @@ dummy_func(
"'%.200s' object is not a mapping",
Py_TYPE(update_o)->tp_name);
}
PyStackRef_CLOSE(update);
ERROR_IF(true);
ERROR_NO_POP();
}
PyStackRef_CLOSE(update);
upd = update;
DEAD(update);
}
macro(DICT_UPDATE) = _DICT_UPDATE + POP_TOP;
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);