mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Issue #25556: Add assertions to PyObject_GetItem() to ensure that an exception
is raised when it returns NULL. Simplify also ceval.c: rely on the fact that PyObject_GetItem() raised an exception when it returns NULL.
This commit is contained in:
parent
ef072961e1
commit
e20310fa19
2 changed files with 10 additions and 5 deletions
|
@ -2307,7 +2307,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
}
|
||||
else {
|
||||
v = PyObject_GetItem(locals, name);
|
||||
if (v == NULL && _PyErr_OCCURRED()) {
|
||||
if (v == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_KeyError))
|
||||
goto error;
|
||||
PyErr_Clear();
|
||||
|
@ -2426,7 +2426,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
|||
}
|
||||
else {
|
||||
value = PyObject_GetItem(locals, name);
|
||||
if (value == NULL && PyErr_Occurred()) {
|
||||
if (value == NULL) {
|
||||
if (!PyErr_ExceptionMatches(PyExc_KeyError))
|
||||
goto error;
|
||||
PyErr_Clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue