mirror of
https://github.com/python/cpython.git
synced 2026-07-26 20:03:16 -04:00
gh-145857: Replace DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL (GH-146314)
This commit is contained in:
+13
-15
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user