mirror of
https://github.com/python/cpython.git
synced 2026-04-13 23:31:02 +00:00
gh-145055: Accept frozendict for globals in exec() and eval() (#145072)
This commit is contained in:
parent
c8aa8de9a5
commit
c0ecf211b2
12 changed files with 66 additions and 22 deletions
|
|
@ -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__");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue