summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r--Python/executor_cases.c.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 4420c40..2e7b970 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1167,14 +1167,14 @@
case _DELETE_GLOBAL: {
oparg = CURRENT_OPARG();
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- int err;
- err = PyDict_DelItem(GLOBALS(), name);
+ int err = PyDict_Pop(GLOBALS(), name, NULL);
// Can't use ERROR_IF here.
- if (err != 0) {
- if (_PyErr_ExceptionMatches(tstate, PyExc_KeyError)) {
- _PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
- NAME_ERROR_MSG, name);
- }
+ if (err < 0) {
+ GOTO_ERROR(error);
+ }
+ if (err == 0) {
+ _PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
+ NAME_ERROR_MSG, name);
GOTO_ERROR(error);
}
break;