gh-145857: Replace DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL (GH-146314)

This commit is contained in:
Brij Kapadia
2026-06-30 14:04:56 -04:00
committed by GitHub
parent c393ab61d9
commit a3dc7849a3
19 changed files with 1047 additions and 1096 deletions
+13 -15
View File
@@ -2163,23 +2163,21 @@ dummy_func(
inst(STORE_GLOBAL, (v --)) {
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
int err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v));
PyStackRef_CLOSE(v);
ERROR_IF(err);
}
inst(DELETE_GLOBAL, (--)) {
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
int err = PyDict_Pop(GLOBALS(), name, NULL);
// Can't use ERROR_IF here.
if (err < 0) {
ERROR_NO_POP();
int err;
if (PyStackRef_IsNull(v)) {
DEAD(v);
err = PyDict_Pop(GLOBALS(), name, NULL);
if (err == 0) {
err = -1;
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
NAME_ERROR_MSG, name);
}
}
if (err == 0) {
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
NAME_ERROR_MSG, name);
ERROR_NO_POP();
else {
err = PyDict_SetItem(GLOBALS(), name, PyStackRef_AsPyObjectBorrow(v));
PyStackRef_CLOSE(v);
}
ERROR_IF(err < 0);
}
inst(LOAD_LOCALS, ( -- locals)) {