Skip to content

Commit

Permalink
fixed error handling of DELETE_GLOBAL
Browse files Browse the repository at this point in the history
  • Loading branch information
blhsing committed Jul 5, 2024
1 parent 55f6dd4 commit 0d347f8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
9 changes: 4 additions & 5 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,11 +1476,10 @@ dummy_func(
int err = PyMapping_DelItem(GLOBALS(), name);
// Can't use ERROR_IF here.
if (err < 0) {
ERROR_NO_POP();
}
if (err == 0) {
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
NAME_ERROR_MSG, name);
if (PyErr_ExceptionMatches(PyExc_KeyError)) {
_PyEval_FormatExcCheckArg(tstate, PyExc_NameError,
NAME_ERROR_MSG, name);
}
ERROR_NO_POP();
}
}
Expand Down
9 changes: 4 additions & 5 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0d347f8

Please sign in to comment.