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

This commit is contained in:
Sacul 2026-03-19 19:17:58 +08:00 committed by GitHub
parent 982459132b
commit 0d37e423d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1030 additions and 981 deletions

View file

@ -2181,13 +2181,18 @@ dummy_func(
PyStackRef_CLOSE(iterable_st);
}
inst(SET_UPDATE, (set, unused[oparg-1], iterable -- set, unused[oparg-1])) {
op(_SET_UPDATE, (set, unused[oparg-1], iterable -- set, unused[oparg-1], i)) {
int err = _PySet_Update(PyStackRef_AsPyObjectBorrow(set),
PyStackRef_AsPyObjectBorrow(iterable));
PyStackRef_CLOSE(iterable);
ERROR_IF(err < 0);
if (err < 0) {
ERROR_NO_POP();
}
i = iterable;
DEAD(iterable);
}
macro(SET_UPDATE) = _SET_UPDATE + POP_TOP;
inst(BUILD_SET, (values[oparg] -- set)) {
PyObject *set_o = PySet_New(NULL);
if (set_o == NULL) {