RestrictedPython 8.1a1.dev0__tar.gz → 8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/.pre-commit-config.yaml +7 -6
  2. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/.readthedocs.yaml +2 -2
  3. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/CHANGES.rst +15 -4
  4. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/CONTRIBUTING.md +2 -2
  5. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/MANIFEST.in +2 -2
  6. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/PKG-INFO +26 -27
  7. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/buildout.cfg +0 -1
  8. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/conf.py +3 -3
  9. restrictedpython-8.2/docs/contributing/ast/python3_14.ast +196 -0
  10. restrictedpython-8.2/docs/contributing/changes_from313to314.rst +5 -0
  11. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/index.rst +6 -6
  12. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/index.rst +1 -1
  13. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/usage/policy.rst +0 -68
  14. restrictedpython-8.2/pyproject.toml +85 -0
  15. restrictedpython-8.2/setup.py +20 -0
  16. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/Guards.py +1 -0
  17. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/_compat.py +2 -1
  18. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/transformer.py +26 -72
  19. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython.egg-info/PKG-INFO +26 -27
  20. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython.egg-info/SOURCES.txt +4 -2
  21. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_NamedExpr.py +1 -1
  22. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_compile.py +5 -14
  23. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_compile_restricted_function.py +6 -18
  24. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_base_types.py +3 -4
  25. restrictedpython-8.2/tests/transformer/test_gen.py +9 -0
  26. restrictedpython-8.2/tests/transformer/test_tstring.py +91 -0
  27. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tox.ini +7 -11
  28. restrictedpython-8.1a1.dev0/docs/contributing/changes_from38to39.rst +0 -5
  29. restrictedpython-8.1a1.dev0/pyproject.toml +0 -33
  30. restrictedpython-8.1a1.dev0/setup.py +0 -68
  31. restrictedpython-8.1a1.dev0/src/RestrictedPython.egg-info/not-zip-safe +0 -1
  32. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/COPYRIGHT.txt +0 -0
  33. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/LICENSE.txt +0 -0
  34. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/README.rst +0 -0
  35. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/constraints.txt +0 -0
  36. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/Makefile +0 -0
  37. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/changes.rst +0 -0
  38. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_10.ast +0 -0
  39. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_11.ast +0 -0
  40. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_12.ast +0 -0
  41. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_13.ast +0 -0
  42. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_8.ast +0 -0
  43. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/ast/python3_9.ast +0 -0
  44. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/changes_from310to311.rst +0 -0
  45. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/changes_from311to312.rst +0 -0
  46. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/changes_from312to313.rst +0 -0
  47. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/contributing/changes_from39to310.rst +0 -0
  48. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/idea.rst +0 -0
  49. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/install/index.rst +0 -0
  50. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/logo.jpg +0 -0
  51. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/make.bat +0 -0
  52. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/requirements.txt +0 -0
  53. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/roadmap/index.rst +0 -0
  54. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/usage/api.rst +0 -0
  55. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/usage/basic_usage.rst +0 -0
  56. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/usage/framework_usage.rst +0 -0
  57. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/docs/usage/index.rst +0 -0
  58. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/setup.cfg +0 -0
  59. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/Eval.py +0 -0
  60. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/Limits.py +0 -0
  61. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/PrintCollector.py +0 -0
  62. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/Utilities.py +0 -0
  63. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/__init__.py +0 -0
  64. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython/compile.py +0 -0
  65. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython.egg-info/dependency_links.txt +0 -0
  66. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython.egg-info/requires.txt +0 -0
  67. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/src/RestrictedPython.egg-info/top_level.txt +0 -0
  68. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/__init__.py +0 -0
  69. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/builtins/test_limits.py +0 -0
  70. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/builtins/test_utilities.py +0 -0
  71. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/helper.py +0 -0
  72. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_Guards.py +0 -0
  73. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_Utilities.py +0 -0
  74. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_eval.py +0 -0
  75. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_imports.py +0 -0
  76. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_iterating_over_dict_items.py +0 -0
  77. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/test_print_function.py +0 -0
  78. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_arithmetic_operators.py +0 -0
  79. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_bit_wise_operators.py +0 -0
  80. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_bool_operators.py +0 -0
  81. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_comparison_operators.py +0 -0
  82. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_identity_operators.py +0 -0
  83. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_logical_operators.py +0 -0
  84. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/operators/test_unary_operators.py +0 -0
  85. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_assert.py +0 -0
  86. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_assign.py +0 -0
  87. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_async.py +0 -0
  88. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_attribute.py +0 -0
  89. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_augassign.py +0 -0
  90. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_breakpoint.py +0 -0
  91. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_call.py +0 -0
  92. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_classdef.py +0 -0
  93. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_comparators.py +0 -0
  94. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_conditional.py +0 -0
  95. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_dict_comprehension.py +0 -0
  96. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_eval_exec.py +0 -0
  97. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_fstring.py +0 -0
  98. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_functiondef.py +0 -0
  99. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_generic.py +0 -0
  100. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_global_local.py +0 -0
  101. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_import.py +0 -0
  102. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_inspect.py +0 -0
  103. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_iterator.py +0 -0
  104. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_lambda.py +0 -0
  105. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_loop.py +0 -0
  106. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_name.py +0 -0
  107. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_slice.py +0 -0
  108. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_subscript.py +0 -0
  109. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_try.py +0 -0
  110. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_with_stmt.py +0 -0
  111. {restrictedpython-8.1a1.dev0 → restrictedpython-8.2}/tests/transformer/test_yield.py +0 -0
@@ -1,9 +1,9 @@
1
- # Generated from:
2
- # https://github.com/zopefoundation/meta/tree/master/config/pure-python
1
+ # Generated with zope.meta (https://zopemeta.readthedocs.io/) from:
2
+ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python
3
3
  minimum_pre_commit_version: '3.6'
4
4
  repos:
5
5
  - repo: https://github.com/pycqa/isort
6
- rev: "6.0.1"
6
+ rev: "8.0.1"
7
7
  hooks:
8
8
  - id: isort
9
9
  - repo: https://github.com/hhatto/autopep8
@@ -12,16 +12,17 @@ repos:
12
12
  - id: autopep8
13
13
  args: [--in-place, --aggressive, --aggressive]
14
14
  - repo: https://github.com/asottile/pyupgrade
15
- rev: v3.19.1
15
+ rev: v3.21.2
16
16
  hooks:
17
17
  - id: pyupgrade
18
- args: [--py39-plus]
18
+ args: [--py310-plus]
19
19
  - repo: https://github.com/isidentical/teyit
20
20
  rev: 0.4.3
21
21
  hooks:
22
22
  - id: teyit
23
+ language_version: python3.13
23
24
  - repo: https://github.com/PyCQA/flake8
24
- rev: "7.1.2"
25
+ rev: "7.3.0"
25
26
  hooks:
26
27
  - id: flake8
27
28
  additional_dependencies:
@@ -1,5 +1,5 @@
1
- # Generated from:
2
- # https://github.com/zopefoundation/meta/tree/master/config/pure-python
1
+ # Generated with zope.meta (https://zopemeta.readthedocs.io/) from:
2
+ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python
3
3
  # Read the Docs configuration file
4
4
  # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
5
5
 
@@ -1,11 +1,22 @@
1
1
  Changes
2
2
  =======
3
3
 
4
- 8.1a1.dev0 (2025-03-20)
5
- -----------------------
4
+ 8.2 (2026-05-29)
5
+ ----------------
6
+
7
+ - Remove documentation that appears to promote unsupported direct guards usage.
8
+
9
+ - Move package metadata from setup.py to pyproject.toml.
10
+
11
+ - Drop support for Python 3.9.
12
+
13
+ - Allow the ``...`` (Ellipsis) statement.
14
+
15
+
16
+ 8.1 (2025-10-19)
17
+ ----------------
6
18
 
7
- - Allow to use the package with Python 3.14 -- Caution: No security
8
- audit has been done so far.
19
+ - Allow to use the package with Python 3.14 including t-string support.
9
20
 
10
21
 
11
22
  8.0 (2025-01-23)
@@ -1,6 +1,6 @@
1
1
  <!--
2
- Generated from:
3
- https://github.com/zopefoundation/meta/tree/master/config/pure-python
2
+ Generated with zope.meta (https://zopemeta.readthedocs.io/) from:
3
+ https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python
4
4
  -->
5
5
  # Contributing to zopefoundation projects
6
6
 
@@ -1,5 +1,5 @@
1
- # Generated from:
2
- # https://github.com/zopefoundation/meta/tree/master/config/pure-python
1
+ # Generated with zope.meta (https://zopemeta.readthedocs.io/) from:
2
+ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python
3
3
  include *.md
4
4
  include *.rst
5
5
  include *.txt
@@ -1,28 +1,27 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: RestrictedPython
3
- Version: 8.1a1.dev0
3
+ Version: 8.2
4
4
  Summary: RestrictedPython is a defined subset of the Python language which allows to provide a program input into a trusted environment.
5
- Home-page: https://github.com/zopefoundation/RestrictedPython
6
- Author: Zope Foundation and Contributors
7
- Author-email: zope-dev@zope.dev
8
- License: ZPL-2.1
5
+ Author-email: Zope Foundation and contributors <zope-dev@zope.dev>
6
+ Maintainer-email: Plone Foundation and contributors <zope-dev@zope.dev>
7
+ License-Expression: ZPL-2.1
9
8
  Project-URL: Documentation, https://restrictedpython.readthedocs.io/
9
+ Project-URL: Issues, https://github.com/zopefoundation/RestrictedPython/issues
10
10
  Project-URL: Source, https://github.com/zopefoundation/RestrictedPython
11
- Project-URL: Tracker, https://github.com/zopefoundation/RestrictedPython/issues
12
- Keywords: restricted execution security untrusted code
11
+ Project-URL: Changelog, https://github.com/zopefoundation/RestrictedPython/blob/master/CHANGES.rst
12
+ Keywords: restricted,execution,security,untrusted,code
13
13
  Classifier: Development Status :: 6 - Mature
14
- Classifier: License :: OSI Approved :: Zope Public License
15
14
  Classifier: Programming Language :: Python
16
15
  Classifier: Operating System :: OS Independent
17
16
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.9
19
17
  Classifier: Programming Language :: Python :: 3.10
20
18
  Classifier: Programming Language :: Python :: 3.11
21
19
  Classifier: Programming Language :: Python :: 3.12
22
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
23
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
23
  Classifier: Topic :: Security
25
- Requires-Python: >=3.9, <3.15
24
+ Requires-Python: <3.15,>=3.10
26
25
  Description-Content-Type: text/x-rst
27
26
  License-File: LICENSE.txt
28
27
  Provides-Extra: test
@@ -31,18 +30,7 @@ Requires-Dist: pytest-mock; extra == "test"
31
30
  Provides-Extra: docs
32
31
  Requires-Dist: Sphinx; extra == "docs"
33
32
  Requires-Dist: furo; extra == "docs"
34
- Dynamic: author
35
- Dynamic: author-email
36
- Dynamic: classifier
37
- Dynamic: description
38
- Dynamic: description-content-type
39
- Dynamic: home-page
40
- Dynamic: keywords
41
- Dynamic: license
42
- Dynamic: project-url
43
- Dynamic: provides-extra
44
- Dynamic: requires-python
45
- Dynamic: summary
33
+ Dynamic: license-file
46
34
 
47
35
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
48
36
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -135,11 +123,22 @@ the documentation `Contributing page
135
123
  Changes
136
124
  =======
137
125
 
138
- 8.1a1.dev0 (2025-03-20)
139
- -----------------------
126
+ 8.2 (2026-05-29)
127
+ ----------------
128
+
129
+ - Remove documentation that appears to promote unsupported direct guards usage.
130
+
131
+ - Move package metadata from setup.py to pyproject.toml.
132
+
133
+ - Drop support for Python 3.9.
134
+
135
+ - Allow the ``...`` (Ellipsis) statement.
136
+
137
+
138
+ 8.1 (2025-10-19)
139
+ ----------------
140
140
 
141
- - Allow to use the package with Python 3.14 -- Caution: No security
142
- audit has been done so far.
141
+ - Allow to use the package with Python 3.14 including t-string support.
143
142
 
144
143
 
145
144
  8.0 (2025-01-23)
@@ -3,7 +3,6 @@ develop = .
3
3
  parts =
4
4
  sphinx
5
5
 
6
-
7
6
  [sphinx]
8
7
  recipe = zc.recipe.egg
9
8
  eggs =
@@ -60,9 +60,9 @@ author = 'The Zope & Plone developer community'
60
60
  # built documents.
61
61
  #
62
62
  # The short X.Y version.
63
- version = '7.5'
63
+ version = '8.2'
64
64
  # The full version, including alpha/beta/rc tags.
65
- release = '7.5'
65
+ release = '8.2'
66
66
 
67
67
  # The language for content autogenerated by Sphinx. Refer to documentation
68
68
  # for a list of supported languages.
@@ -112,11 +112,11 @@ todo_include_todos = True
112
112
  # Intersphinx Mapping for Links between different Documentations
113
113
  intersphinx_mapping = {
114
114
  'python3': ('https://docs.python.org/3', None),
115
- 'python39': ('https://docs.python.org/3.9', None),
116
115
  'python310': ('https://docs.python.org/3.10', None),
117
116
  'python311': ('https://docs.python.org/3.11', None),
118
117
  'python312': ('https://docs.python.org/3.12', None),
119
118
  'python313': ('https://docs.python.org/3.13', None),
119
+ 'python314': ('https://docs.python.org/3.14', None),
120
120
  }
121
121
 
122
122
  # Options for sphinx.ext.todo:
@@ -0,0 +1,196 @@
1
+ -- Python 3.14 AST
2
+ -- ASDL's 4 builtin types are:
3
+ -- identifier, int, string, constant
4
+
5
+ module Python version "3.14"
6
+ {
7
+ mod = Module(stmt* body, type_ignore* type_ignores)
8
+ | Interactive(stmt* body)
9
+ | Expression(expr body)
10
+ | FunctionType(expr* argtypes, expr returns)
11
+
12
+ stmt = FunctionDef(identifier name,
13
+ arguments args,
14
+ stmt* body,
15
+ expr* decorator_list,
16
+ expr? returns,
17
+ string? type_comment,
18
+ type_param* type_params)
19
+ | AsyncFunctionDef(identifier name,
20
+ arguments args,
21
+ stmt* body,
22
+ expr* decorator_list,
23
+ expr? returns,
24
+ string? type_comment,
25
+ type_param* type_params)
26
+
27
+ | ClassDef(identifier name,
28
+ expr* bases,
29
+ keyword* keywords,
30
+ stmt* body,
31
+ expr* decorator_list,
32
+ type_param* type_params)
33
+ | Return(expr? value)
34
+
35
+ | Delete(expr* targets)
36
+ | Assign(expr* targets, expr value, string? type_comment)
37
+ | TypeAlias(expr name, type_param* type_params, expr value)
38
+ | AugAssign(expr target, operator op, expr value)
39
+ -- 'simple' indicates that we annotate simple name without parens
40
+ | AnnAssign(expr target, expr annotation, expr? value, int simple)
41
+
42
+ -- use 'orelse' because else is a keyword in target languages
43
+ | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
44
+ | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)
45
+ | While(expr test, stmt* body, stmt* orelse)
46
+ | If(expr test, stmt* body, stmt* orelse)
47
+ | With(withitem* items, stmt* body, string? type_comment)
48
+ | AsyncWith(withitem* items, stmt* body, string? type_comment)
49
+
50
+ | Match(expr subject, match_case* cases)
51
+
52
+ | Raise(expr? exc, expr? cause)
53
+ | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
54
+ | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)
55
+ | Assert(expr test, expr? msg)
56
+
57
+ | Import(alias* names)
58
+ | ImportFrom(identifier? module, alias* names, int? level)
59
+
60
+ | Global(identifier* names)
61
+ | Nonlocal(identifier* names)
62
+ | Expr(expr value)
63
+ | Pass
64
+ | Break
65
+ | Continue
66
+
67
+ -- col_offset is the byte offset in the utf8 string the parser uses
68
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
69
+
70
+ -- BoolOp() can use left & right?
71
+ expr = BoolOp(boolop op, expr* values)
72
+ | NamedExpr(expr target, expr value)
73
+ | BinOp(expr left, operator op, expr right)
74
+ | UnaryOp(unaryop op, expr operand)
75
+ | Lambda(arguments args, expr body)
76
+ | IfExp(expr test, expr body, expr orelse)
77
+ | Dict(expr?* keys, expr* values)
78
+ | Set(expr* elts)
79
+ | ListComp(expr elt, comprehension* generators)
80
+ | SetComp(expr elt, comprehension* generators)
81
+ | DictComp(expr key, expr value, comprehension* generators)
82
+ | GeneratorExp(expr elt, comprehension* generators)
83
+ -- the grammar constrains where yield expressions can occur
84
+ | Await(expr value)
85
+ | Yield(expr? value)
86
+ | YieldFrom(expr value)
87
+ -- need sequences for compare to distinguish between
88
+ -- x < 4 < 3 and (x < 4) < 3
89
+ | Compare(expr left, cmpop* ops, expr* comparators)
90
+ | Call(expr func, expr* args, keyword* keywords)
91
+ | FormattedValue(expr value, int conversion, expr? format_spec)
92
+ | Interpolation(expr value, constant str, int conversion, expr? format_spec)
93
+ | JoinedStr(expr* values)
94
+ | TemplateStr(expr* values)
95
+ | Constant(constant value, string? kind)
96
+
97
+ -- the following expression can appear in assignment context
98
+ | Attribute(expr value, identifier attr, expr_context ctx)
99
+ | Subscript(expr value, expr slice, expr_context ctx)
100
+ | Starred(expr value, expr_context ctx)
101
+ | Name(identifier id, expr_context ctx)
102
+ | List(expr* elts, expr_context ctx)
103
+ | Tuple(expr* elts, expr_context ctx)
104
+
105
+ -- can appear only in Subscript
106
+ | Slice(expr? lower, expr? upper, expr? step)
107
+
108
+ -- col_offset is the byte offset in the utf8 string the parser uses
109
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
110
+
111
+ expr_context = Load
112
+ | Store
113
+ | Del
114
+
115
+ boolop = And
116
+ | Or
117
+
118
+ operator = Add
119
+ | Sub
120
+ | Mult
121
+ | MatMult
122
+ | Div
123
+ | Mod
124
+ | Pow
125
+ | LShift
126
+ | RShift
127
+ | BitOr
128
+ | BitXor
129
+ | BitAnd
130
+ | FloorDiv
131
+
132
+ unaryop = Invert
133
+ | Not
134
+ | UAdd
135
+ | USub
136
+
137
+ cmpop = Eq
138
+ | NotEq
139
+ | Lt
140
+ | LtE
141
+ | Gt
142
+ | GtE
143
+ | Is
144
+ | IsNot
145
+ | In
146
+ | NotIn
147
+
148
+ comprehension = (expr target, expr iter, expr* ifs, int is_async)
149
+
150
+ excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
151
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
152
+
153
+ arguments = (arg* posonlyargs,
154
+ arg* args,
155
+ arg? vararg,
156
+ arg* kwonlyargs,
157
+ expr* kw_defaults,
158
+ arg? kwarg,
159
+ expr* defaults)
160
+
161
+ arg = (identifier arg, expr? annotation, string? type_comment)
162
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
163
+
164
+ -- keyword arguments supplied to call (NULL identifier for **kwargs)
165
+ keyword = (identifier? arg, expr value)
166
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
167
+
168
+ -- import name with optional 'as' alias.
169
+ alias = (identifier name, identifier? asname)
170
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
171
+
172
+ withitem = (expr context_expr, expr? optional_vars)
173
+
174
+ match_case = (pattern pattern, expr? guard, stmt* body)
175
+
176
+ pattern = MatchValue(expr value)
177
+ | MatchSingleton(constant value)
178
+ | MatchSequence(pattern* patterns)
179
+ | MatchMapping(expr* keys, pattern* patterns, identifier? rest)
180
+ | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
181
+
182
+ | MatchStar(identifier? name)
183
+ -- The optional "rest" MatchMapping parameter handles capturing extra mapping keys
184
+
185
+ | MatchAs(pattern? pattern, identifier? name)
186
+ | MatchOr(pattern* patterns)
187
+
188
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
189
+
190
+ type_ignore = TypeIgnore(int lineno, string tag)
191
+
192
+ type_param = TypeVar(identifier name, expr? bound, expr? default_value)
193
+ | ParamSpec(identifier name, expr? default_value)
194
+ | TypeVarTuple(identifier name, expr? default_value)
195
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
196
+ }
@@ -0,0 +1,5 @@
1
+ Changes from Python 3.13 to Python 3.14
2
+ ---------------------------------------
3
+
4
+ .. literalinclude:: ast/python3_14.ast
5
+ :diff: ast/python3_13.ast
@@ -98,11 +98,11 @@ A (modified style) Copy of all Abstract Grammar Definitions for the Python versi
98
98
  .. toctree::
99
99
  :maxdepth: 2
100
100
 
101
- changes_from38to39
102
101
  changes_from39to310
103
102
  changes_from310to311
104
103
  changes_from311to312
105
104
  changes_from312to313
105
+ changes_from313to314
106
106
 
107
107
  .. _understand:
108
108
 
@@ -235,11 +235,11 @@ Technical Backgrounds - Links to External Documentation
235
235
 
236
236
  * AST Grammar of Python (`Status of Python Versions`_)
237
237
 
238
+ * `Python 3.14 AST`_ (EOL 2030-10)
238
239
  * `Python 3.13 AST`_ (EOL 2029-10)
239
240
  * `Python 3.12 AST`_ (EOL 2028-10)
240
241
  * `Python 3.11 AST`_ (EOL 2027-10)
241
242
  * `Python 3.10 AST`_ (EOL 2026-10)
242
- * `Python 3.9 AST`_ (EOL 2025-10)
243
243
 
244
244
  * `AST NodeVistiors Class`_
245
245
  * `AST NodeTransformer Class`_
@@ -257,6 +257,8 @@ Todos
257
257
 
258
258
  .. _`What's new in Python`: https://docs.python.org/3/whatsnew/
259
259
 
260
+ .. _`What's new in Python 3.14`: https://docs.python.org/3.14/whatsnew/3.14.html
261
+
260
262
  .. _`What's new in Python 3.13`: https://docs.python.org/3.13/whatsnew/3.13.html
261
263
 
262
264
  .. _`What's new in Python 3.12`: https://docs.python.org/3.12/whatsnew/3.12.html
@@ -265,8 +267,6 @@ Todos
265
267
 
266
268
  .. _`What's new in Python 3.10`: https://docs.python.org/3.10/whatsnew/3.10.html
267
269
 
268
- .. _`What's new in Python 3.9`: https://docs.python.org/3.9/whatsnew/3.9.html
269
-
270
270
  .. _`Status of Python Versions`: https://devguide.python.org/versions/
271
271
 
272
272
  .. _`Concept of Immutable Types and Python Example`: https://en.wikipedia.org/wiki/Immutable_object#Python
@@ -281,6 +281,8 @@ Todos
281
281
 
282
282
  .. _`Python 3 AST`: https://docs.python.org/3/library/ast.html#abstract-grammar
283
283
 
284
+ .. _`Python 3.14 AST`: https://docs.python.org/3.14/library/ast.html#abstract-grammar
285
+
284
286
  .. _`Python 3.13 AST`: https://docs.python.org/3.13/library/ast.html#abstract-grammar
285
287
 
286
288
  .. _`Python 3.12 AST`: https://docs.python.org/3.12/library/ast.html#abstract-grammar
@@ -289,8 +291,6 @@ Todos
289
291
 
290
292
  .. _`Python 3.10 AST`: https://docs.python.org/3.10/library/ast.html#abstract-grammar
291
293
 
292
- .. _`Python 3.9 AST`: https://docs.python.org/3.9/library/ast.html#abstract-grammar
293
-
294
294
  .. _`AST NodeVistiors Class`: https://docs.python.org/3/library/ast.html#ast.NodeVisitor
295
295
 
296
296
  .. _`AST NodeTransformer Class`: https://docs.python.org/3/library/ast.html#ast.NodeTransformer
@@ -15,7 +15,7 @@ RestrictedPython is not a sandbox system or a secured environment, but it helps
15
15
  Supported Python versions
16
16
  =========================
17
17
 
18
- RestrictedPython supports CPython 3.9 up to 3.13.
18
+ RestrictedPython supports CPython 3.10 up to 3.14.
19
19
  It does _not_ support PyPy or other alternative Python implementations.
20
20
 
21
21
  Contents
@@ -167,71 +167,3 @@ unsafe operations, such as opening files:
167
167
  Traceback (most recent call last):
168
168
  ...
169
169
  NameError: name 'open' is not defined
170
-
171
- Guards
172
- ......
173
-
174
- Here's an example of a write guard that never lets restricted code
175
- modify (assign, delete an attribute or item) except dictionaries and
176
- lists:
177
-
178
- .. code-block:: pycon
179
-
180
- >>> from RestrictedPython.Guards import full_write_guard
181
- >>> _write_ = full_write_guard
182
- >>> _getattr_ = getattr
183
-
184
- >>> class BikeShed(object):
185
- ... colour = 'green'
186
- ...
187
- >>> shed = BikeShed()
188
-
189
- Normally accessing attributes works as expected, because we're using
190
- the standard ``getattr`` function for the ``_getattr_`` guard:
191
-
192
- .. code-block:: pycon
193
-
194
- >>> src = '''
195
- ... print(shed.colour)
196
- ... result = printed
197
- ... '''
198
- >>> code = compile_restricted(src, '<string>', 'exec')
199
- >>> exec(code)
200
-
201
- >>> result
202
- 'green\n'
203
-
204
- However, changing an attribute doesn't work:
205
-
206
- .. code-block:: pycon
207
-
208
- >>> src = '''
209
- ... shed.colour = 'red'
210
- ... '''
211
- >>> code = compile_restricted(src, '<string>', 'exec')
212
- >>> exec(code)
213
- Traceback (most recent call last):
214
- ...
215
- TypeError: attribute-less object (assign or del)
216
-
217
- As said, this particular write guard (``full_write_guard``) will allow
218
- restricted code to modify lists and dictionaries:
219
-
220
- .. code-block:: pycon
221
-
222
- >>> fibonacci = [1, 1, 2, 3, 4]
223
- >>> transl = dict(one=1, two=2, tres=3)
224
- >>> src = '''
225
- ... # correct mistake in list
226
- ... fibonacci[-1] = 5
227
- ... # one item doesn't belong
228
- ... del transl['tres']
229
- ... '''
230
- >>> code = compile_restricted(src, '<string>', 'exec')
231
- >>> exec(code)
232
-
233
- >>> fibonacci
234
- [1, 1, 2, 3, 5]
235
-
236
- >>> sorted(transl.keys())
237
- ['one', 'two']
@@ -0,0 +1,85 @@
1
+ # Generated with zope.meta (https://zopemeta.readthedocs.io/) from:
2
+ # https://github.com/zopefoundation/meta/tree/master/src/zope/meta/pure-python
3
+ [build-system]
4
+ requires = [
5
+ "setuptools >= 78.1.1,< 82",
6
+ "wheel",
7
+ ]
8
+ build-backend = "setuptools.build_meta"
9
+
10
+ [project]
11
+ name = "RestrictedPython"
12
+ version = "8.2"
13
+ description = "RestrictedPython is a defined subset of the Python language which allows to provide a program input into a trusted environment."
14
+ license = "ZPL-2.1"
15
+ classifiers = [
16
+ "Development Status :: 6 - Mature",
17
+ "Programming Language :: Python",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Programming Language :: Python :: Implementation :: CPython",
26
+ "Topic :: Security",
27
+ ]
28
+ dynamic = ["readme"]
29
+ requires-python = ">=3.10, <3.15"
30
+ authors = [
31
+ {name = "Zope Foundation and contributors",email = "zope-dev@zope.dev"},
32
+ ]
33
+ maintainers = [
34
+ {name = "Plone Foundation and contributors",email = "zope-dev@zope.dev"},
35
+ ]
36
+ keywords = [
37
+ "restricted",
38
+ "execution",
39
+ "security",
40
+ "untrusted",
41
+ "code",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ test = [
46
+ "pytest",
47
+ "pytest-mock",
48
+ ]
49
+ docs = [
50
+ "Sphinx",
51
+ "furo",
52
+ ]
53
+
54
+ [project.urls]
55
+ Documentation = "https://restrictedpython.readthedocs.io/"
56
+ Issues = "https://github.com/zopefoundation/RestrictedPython/issues"
57
+ Source = "https://github.com/zopefoundation/RestrictedPython"
58
+ Changelog = "https://github.com/zopefoundation/RestrictedPython/blob/master/CHANGES.rst"
59
+
60
+ [tool.coverage.run]
61
+ branch = true
62
+ source = ["RestrictedPython"]
63
+
64
+ [tool.coverage.report]
65
+ fail_under = 97.1
66
+ precision = 2
67
+ ignore_errors = true
68
+ show_missing = true
69
+ exclude_lines = [
70
+ "pragma: no cover",
71
+ "pragma: nocover",
72
+ "except ImportError:",
73
+ "raise NotImplementedError",
74
+ "if __name__ == '__main__':",
75
+ "self.fail",
76
+ "raise AssertionError",
77
+ "raise unittest.Skip",
78
+ ]
79
+
80
+ [tool.coverage.html]
81
+ directory = "parts/htmlcov"
82
+
83
+ [tool.setuptools.dynamic]
84
+ readme = {file = ["README.rst", "CHANGES.rst"]}
85
+
@@ -0,0 +1,20 @@
1
+ ##############################################################################
2
+ #
3
+ # Copyright (c) 2006 Zope Foundation and Contributors.
4
+ # All Rights Reserved.
5
+ #
6
+ # This software is subject to the provisions of the Zope Public License,
7
+ # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8
+ # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
+ # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
+ # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
+ # FOR A PARTICULAR PURPOSE.
12
+ #
13
+ ##############################################################################
14
+ """Setup for RestrictedPython package"""
15
+
16
+ from setuptools import setup
17
+
18
+
19
+ # See pyproject.toml for package metadata
20
+ setup()
@@ -27,6 +27,7 @@ _safe_names = [
27
27
  'None',
28
28
  'False',
29
29
  'True',
30
+ 'Ellipsis',
30
31
  'abs',
31
32
  'bool',
32
33
  'bytes',