mirror of
https://github.com/python/cpython.git
synced 2026-05-07 05:01:13 -04:00
gh-145055: Accept frozendict for globals in exec() and eval() (#145072)
This commit is contained in:
+3
-2
@@ -1348,8 +1348,9 @@ static PyObject *
|
||||
run_eval_code_obj(PyThreadState *tstate, PyCodeObject *co, PyObject *globals, PyObject *locals)
|
||||
{
|
||||
/* Set globals['__builtins__'] if it doesn't exist */
|
||||
if (!globals || !PyDict_Check(globals)) {
|
||||
PyErr_SetString(PyExc_SystemError, "globals must be a real dict");
|
||||
if (!globals || !PyAnyDict_Check(globals)) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"globals must be a real dict or a real frozendict");
|
||||
return NULL;
|
||||
}
|
||||
int has_builtins = PyDict_ContainsString(globals, "__builtins__");
|
||||
|
||||
Reference in New Issue
Block a user