Skip to content

Commit 07b3510

Browse files
committed
exec(): accept frozendict for globals
1 parent 302767b commit 07b3510

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Objects/dictobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ _PyDict_LoadGlobalStackRef(PyDictObject *globals, PyDictObject *builtins, PyObje
26232623
PyObject *
26242624
_PyDict_LoadBuiltinsFromGlobals(PyObject *globals)
26252625
{
2626-
if (!PyDict_Check(globals)) {
2626+
if (!_PyAnyDict_Check(globals)) {
26272627
PyErr_BadInternalCall();
26282628
return NULL;
26292629
}

Python/bltinmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
11351135
locals = Py_NewRef(globals);
11361136
}
11371137

1138-
if (!PyDict_Check(globals)) {
1138+
if (!_PyAnyDict_Check(globals)) {
11391139
PyErr_Format(PyExc_TypeError, "exec() globals must be a dict, not %.100s",
11401140
Py_TYPE(globals)->tp_name);
11411141
goto error;

Python/pythonrun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ static PyObject *
13531353
run_eval_code_obj(PyThreadState *tstate, PyCodeObject *co, PyObject *globals, PyObject *locals)
13541354
{
13551355
/* Set globals['__builtins__'] if it doesn't exist */
1356-
if (!globals || !PyDict_Check(globals)) {
1356+
if (!globals || !_PyAnyDict_Check(globals)) {
13571357
PyErr_SetString(PyExc_SystemError, "globals must be a real dict");
13581358
return NULL;
13591359
}

0 commit comments

Comments
 (0)