Commit 458c320a authored by Victor Stinner's avatar Victor Stinner

Issue #25556: Fix LOAD_GLOBAL bytecode when globals type is not dict and the

requested name doesn't exist in globals: clear the KeyError exception before
calling PyObject_GetItem(). Fail also if the raised exception is not a
KeyError.
parent b26ca8b2
......@@ -2363,6 +2363,10 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
/* Slow-path if globals or builtins is not a dict */
v = PyObject_GetItem(f->f_globals, name);
if (v == NULL) {
if (!PyErr_ExceptionMatches(PyExc_KeyError))
goto error;
PyErr_Clear();
v = PyObject_GetItem(f->f_builtins, name);
if (v == NULL) {
if (PyErr_ExceptionMatches(PyExc_KeyError))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment