Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changes

- Allow ``ast.Module``, ``ast.Expression`` and ``ast.Interactive`` as body in compile_restricted_function

- Disallow ``mode="function"`` in ``compile_restricted`` (it never worked).

8.3 (2026-06-16)
----------------

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ API overview

:param source: (required). the source code that should be compiled
:param filename: (optional). defaults to ``'<unknown>'``
:param mode: (optional). Use ``'exec'``, ``'eval'``, ``'single'`` or ``'function'``. defaults to ``'exec'``
:param mode: (optional). Use ``'exec'``, ``'eval'`` or ``'single'``. defaults to ``'exec'``
:param flags: (optional). defaults to ``0``
:param dont_inherit: (optional). defaults to ``False``
:param policy: (optional). defaults to ``RestrictingNodeTransformer``
Expand Down
2 changes: 1 addition & 1 deletion src/RestrictedPython/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def compile_restricted(
policy ... `ast.NodeTransformer` class defining the restrictions.

"""
if mode in ['exec', 'eval', 'single', 'function']:
if mode in ['exec', 'eval', 'single']:
result = _compile_restricted_mode(
source,
filename=filename,
Expand Down
Loading