Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue bpo-31968 #4313

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,3 @@
exec(): fixed overloaded __getitem__ method is not called for load default
argument in class method definition for dict-iherited object passed as
globals.
12 changes: 11 additions & 1 deletion Python/ceval.c
Expand Up @@ -2117,7 +2117,17 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
}
}
if (v == NULL) {
v = PyDict_GetItem(f->f_globals, name);
if (PyDict_CheckExact(f->f_globals)) {
v = PyDict_GetItem(f->f_globals, name);
}
else {
v = PyObject_GetItem(f->f_globals, name);
if (v == NULL && _PyErr_OCCURRED()) {
if (!PyErr_ExceptionMatches(PyExc_KeyError))
goto error;
PyErr_Clear();
}
}
Py_XINCREF(v);
if (v == NULL) {
if (PyDict_CheckExact(f->f_builtins)) {
Expand Down