@@ -594,7 +594,7 @@ are always available. They are listed here in alphabetical order.
594594
595595 :param globals:
596596 The global namespace (default: ``None ``).
597- :type globals: :class: `dict ` | ``None ``
597+ :type globals: :class: `dict ` | :class: ` frozendict ` | ``None ``
598598
599599 :param locals:
600600 The local namespace (default: ``None ``).
@@ -643,6 +643,10 @@ are always available. They are listed here in alphabetical order.
643643 If the given source is a string, then leading and trailing spaces and tabs
644644 are stripped.
645645
646+ It's possible to pass :class: `frozendict ` to *globals * if the
647+ :class: `!frozendict ` has a ``__builtins__ `` item. In this case, it's not
648+ possible to assign or reassign global variables.
649+
646650 See :func: `ast.literal_eval ` for a function that can safely evaluate strings
647651 with expressions containing only literals.
648652
@@ -660,6 +664,10 @@ are always available. They are listed here in alphabetical order.
660664 The semantics of the default *locals * namespace have been adjusted as
661665 described for the :func: `locals ` builtin.
662666
667+ .. versionchanged :: next
668+
669+ *globals * can now be a :class: `frozendict `.
670+
663671.. index :: pair: built-in function; exec
664672
665673.. function :: exec(source, /, globals=None, locals=None, *, closure=None)
@@ -688,6 +696,10 @@ are always available. They are listed here in alphabetical order.
688696 respectively. If provided, *locals * can be any mapping object. Remember
689697 that at the module level, globals and locals are the same dictionary.
690698
699+ It's possible to pass :class: `frozendict ` to *globals * if the
700+ :class: `!frozendict ` has a ``__builtins__ `` item. In this case, it's not
701+ possible to assign or reassign global variables.
702+
691703 .. note ::
692704
693705 When ``exec `` gets two separate objects as *globals * and *locals *, the
@@ -737,6 +749,10 @@ are always available. They are listed here in alphabetical order.
737749 The semantics of the default *locals * namespace have been adjusted as
738750 described for the :func: `locals ` builtin.
739751
752+ .. versionchanged :: next
753+
754+ *globals * can now be a :class: `frozendict `.
755+
740756
741757.. function :: filter(function, iterable, /)
742758
0 commit comments