RestrictedPython 8.1__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 (131) hide show
  1. {restrictedpython-8.1 → restrictedpython-8.2}/.pre-commit-config.yaml +6 -5
  2. {restrictedpython-8.1 → restrictedpython-8.2}/.readthedocs.yaml +2 -2
  3. {restrictedpython-8.1 → restrictedpython-8.2}/CHANGES.rst +11 -6
  4. {restrictedpython-8.1 → restrictedpython-8.2}/CONTRIBUTING.md +2 -2
  5. {restrictedpython-8.1 → restrictedpython-8.2}/MANIFEST.in +2 -2
  6. {restrictedpython-8.1 → restrictedpython-8.2}/PKG-INFO +19 -28
  7. {restrictedpython-8.1 → restrictedpython-8.2}/buildout.cfg +0 -1
  8. {restrictedpython-8.1 → restrictedpython-8.2}/docs/conf.py +2 -3
  9. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/index.rst +0 -6
  10. {restrictedpython-8.1 → restrictedpython-8.2}/docs/index.rst +1 -1
  11. {restrictedpython-8.1 → restrictedpython-8.2}/docs/usage/policy.rst +0 -68
  12. restrictedpython-8.2/pyproject.toml +85 -0
  13. restrictedpython-8.2/setup.py +20 -0
  14. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/Guards.py +1 -0
  15. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/_compat.py +0 -1
  16. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/transformer.py +3 -72
  17. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython.egg-info/PKG-INFO +19 -28
  18. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython.egg-info/SOURCES.txt +1 -22
  19. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_NamedExpr.py +1 -1
  20. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_compile.py +5 -14
  21. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_compile_restricted_function.py +6 -18
  22. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_base_types.py +3 -4
  23. restrictedpython-8.2/tests/transformer/test_gen.py +9 -0
  24. {restrictedpython-8.1 → restrictedpython-8.2}/tox.ini +7 -11
  25. restrictedpython-8.1/docs/_build/doctest/output.txt +0 -35
  26. restrictedpython-8.1/docs/_build/html/_sources/changes.rst.txt +0 -1
  27. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from310to311.rst.txt +0 -5
  28. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from311to312.rst.txt +0 -5
  29. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from312to313.rst.txt +0 -5
  30. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from313to314.rst.txt +0 -5
  31. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from38to39.rst.txt +0 -5
  32. restrictedpython-8.1/docs/_build/html/_sources/contributing/changes_from39to310.rst.txt +0 -5
  33. restrictedpython-8.1/docs/_build/html/_sources/contributing/index.rst.txt +0 -308
  34. restrictedpython-8.1/docs/_build/html/_sources/idea.rst.txt +0 -85
  35. restrictedpython-8.1/docs/_build/html/_sources/index.rst.txt +0 -42
  36. restrictedpython-8.1/docs/_build/html/_sources/install/index.rst.txt +0 -10
  37. restrictedpython-8.1/docs/_build/html/_sources/roadmap/index.rst.txt +0 -33
  38. restrictedpython-8.1/docs/_build/html/_sources/usage/api.rst.txt +0 -139
  39. restrictedpython-8.1/docs/_build/html/_sources/usage/basic_usage.rst.txt +0 -175
  40. restrictedpython-8.1/docs/_build/html/_sources/usage/framework_usage.rst.txt +0 -86
  41. restrictedpython-8.1/docs/_build/html/_sources/usage/index.rst.txt +0 -9
  42. restrictedpython-8.1/docs/_build/html/_sources/usage/policy.rst.txt +0 -237
  43. restrictedpython-8.1/docs/_build/html/_static/scripts/furo.js.LICENSE.txt +0 -7
  44. restrictedpython-8.1/docs/contributing/changes_from38to39.rst +0 -5
  45. restrictedpython-8.1/docs/logo.jpg +0 -0
  46. restrictedpython-8.1/pyproject.toml +0 -33
  47. restrictedpython-8.1/setup.py +0 -69
  48. restrictedpython-8.1/src/RestrictedPython.egg-info/not-zip-safe +0 -1
  49. {restrictedpython-8.1 → restrictedpython-8.2}/COPYRIGHT.txt +0 -0
  50. {restrictedpython-8.1 → restrictedpython-8.2}/LICENSE.txt +0 -0
  51. {restrictedpython-8.1 → restrictedpython-8.2}/README.rst +0 -0
  52. {restrictedpython-8.1 → restrictedpython-8.2}/constraints.txt +0 -0
  53. {restrictedpython-8.1 → restrictedpython-8.2}/docs/Makefile +0 -0
  54. {restrictedpython-8.1 → restrictedpython-8.2}/docs/changes.rst +0 -0
  55. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_10.ast +0 -0
  56. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_11.ast +0 -0
  57. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_12.ast +0 -0
  58. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_13.ast +0 -0
  59. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_14.ast +0 -0
  60. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_8.ast +0 -0
  61. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/ast/python3_9.ast +0 -0
  62. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/changes_from310to311.rst +0 -0
  63. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/changes_from311to312.rst +0 -0
  64. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/changes_from312to313.rst +0 -0
  65. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/changes_from313to314.rst +0 -0
  66. {restrictedpython-8.1 → restrictedpython-8.2}/docs/contributing/changes_from39to310.rst +0 -0
  67. {restrictedpython-8.1 → restrictedpython-8.2}/docs/idea.rst +0 -0
  68. {restrictedpython-8.1 → restrictedpython-8.2}/docs/install/index.rst +0 -0
  69. {restrictedpython-8.1/docs/_build/html/_images → restrictedpython-8.2/docs}/logo.jpg +0 -0
  70. {restrictedpython-8.1 → restrictedpython-8.2}/docs/make.bat +0 -0
  71. {restrictedpython-8.1 → restrictedpython-8.2}/docs/requirements.txt +0 -0
  72. {restrictedpython-8.1 → restrictedpython-8.2}/docs/roadmap/index.rst +0 -0
  73. {restrictedpython-8.1 → restrictedpython-8.2}/docs/usage/api.rst +0 -0
  74. {restrictedpython-8.1 → restrictedpython-8.2}/docs/usage/basic_usage.rst +0 -0
  75. {restrictedpython-8.1 → restrictedpython-8.2}/docs/usage/framework_usage.rst +0 -0
  76. {restrictedpython-8.1 → restrictedpython-8.2}/docs/usage/index.rst +0 -0
  77. {restrictedpython-8.1 → restrictedpython-8.2}/setup.cfg +0 -0
  78. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/Eval.py +0 -0
  79. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/Limits.py +0 -0
  80. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/PrintCollector.py +0 -0
  81. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/Utilities.py +0 -0
  82. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/__init__.py +0 -0
  83. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython/compile.py +0 -0
  84. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython.egg-info/dependency_links.txt +0 -0
  85. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython.egg-info/requires.txt +0 -0
  86. {restrictedpython-8.1 → restrictedpython-8.2}/src/RestrictedPython.egg-info/top_level.txt +0 -0
  87. {restrictedpython-8.1 → restrictedpython-8.2}/tests/__init__.py +0 -0
  88. {restrictedpython-8.1 → restrictedpython-8.2}/tests/builtins/test_limits.py +0 -0
  89. {restrictedpython-8.1 → restrictedpython-8.2}/tests/builtins/test_utilities.py +0 -0
  90. {restrictedpython-8.1 → restrictedpython-8.2}/tests/helper.py +0 -0
  91. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_Guards.py +0 -0
  92. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_Utilities.py +0 -0
  93. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_eval.py +0 -0
  94. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_imports.py +0 -0
  95. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_iterating_over_dict_items.py +0 -0
  96. {restrictedpython-8.1 → restrictedpython-8.2}/tests/test_print_function.py +0 -0
  97. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_arithmetic_operators.py +0 -0
  98. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_bit_wise_operators.py +0 -0
  99. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_bool_operators.py +0 -0
  100. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_comparison_operators.py +0 -0
  101. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_identity_operators.py +0 -0
  102. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_logical_operators.py +0 -0
  103. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/operators/test_unary_operators.py +0 -0
  104. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_assert.py +0 -0
  105. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_assign.py +0 -0
  106. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_async.py +0 -0
  107. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_attribute.py +0 -0
  108. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_augassign.py +0 -0
  109. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_breakpoint.py +0 -0
  110. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_call.py +0 -0
  111. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_classdef.py +0 -0
  112. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_comparators.py +0 -0
  113. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_conditional.py +0 -0
  114. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_dict_comprehension.py +0 -0
  115. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_eval_exec.py +0 -0
  116. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_fstring.py +0 -0
  117. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_functiondef.py +0 -0
  118. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_generic.py +0 -0
  119. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_global_local.py +0 -0
  120. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_import.py +0 -0
  121. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_inspect.py +0 -0
  122. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_iterator.py +0 -0
  123. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_lambda.py +0 -0
  124. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_loop.py +0 -0
  125. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_name.py +0 -0
  126. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_slice.py +0 -0
  127. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_subscript.py +0 -0
  128. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_try.py +0 -0
  129. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_tstring.py +0 -0
  130. {restrictedpython-8.1 → restrictedpython-8.2}/tests/transformer/test_with_stmt.py +0 -0
  131. {restrictedpython-8.1 → 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: "7.0.0"
6
+ rev: "8.0.1"
7
7
  hooks:
8
8
  - id: isort
9
9
  - repo: https://github.com/hhatto/autopep8
@@ -12,14 +12,15 @@ repos:
12
12
  - id: autopep8
13
13
  args: [--in-place, --aggressive, --aggressive]
14
14
  - repo: https://github.com/asottile/pyupgrade
15
- rev: v3.21.0
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
25
  rev: "7.3.0"
25
26
  hooks:
@@ -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,17 +1,22 @@
1
1
  Changes
2
2
  =======
3
3
 
4
- 8.1 (2025-10-19)
4
+ 8.2 (2026-05-29)
5
5
  ----------------
6
6
 
7
- - Allow to use the package with Python 3.14 including t-string support.
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.
8
12
 
13
+ - Allow the ``...`` (Ellipsis) statement.
9
14
 
10
- 8.1a1.dev0 (2025-03-20)
11
- -----------------------
12
15
 
13
- - Allow to use the package with Python 3.14 -- Caution: No security
14
- audit has been done so far.
16
+ 8.1 (2025-10-19)
17
+ ----------------
18
+
19
+ - Allow to use the package with Python 3.14 including t-string support.
15
20
 
16
21
 
17
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,21 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RestrictedPython
3
- Version: 8.1
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
@@ -23,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
23
21
  Classifier: Programming Language :: Python :: 3.14
24
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
23
  Classifier: Topic :: Security
26
- Requires-Python: >=3.9, <3.15
24
+ Requires-Python: <3.15,>=3.10
27
25
  Description-Content-Type: text/x-rst
28
26
  License-File: LICENSE.txt
29
27
  Provides-Extra: test
@@ -32,19 +30,7 @@ Requires-Dist: pytest-mock; extra == "test"
32
30
  Provides-Extra: docs
33
31
  Requires-Dist: Sphinx; extra == "docs"
34
32
  Requires-Dist: furo; extra == "docs"
35
- Dynamic: author
36
- Dynamic: author-email
37
- Dynamic: classifier
38
- Dynamic: description
39
- Dynamic: description-content-type
40
- Dynamic: home-page
41
- Dynamic: keywords
42
- Dynamic: license
43
33
  Dynamic: license-file
44
- Dynamic: project-url
45
- Dynamic: provides-extra
46
- Dynamic: requires-python
47
- Dynamic: summary
48
34
 
49
35
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
50
36
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -137,17 +123,22 @@ the documentation `Contributing page
137
123
  Changes
138
124
  =======
139
125
 
140
- 8.1 (2025-10-19)
126
+ 8.2 (2026-05-29)
141
127
  ----------------
142
128
 
143
- - Allow to use the package with Python 3.14 including t-string support.
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.
144
134
 
135
+ - Allow the ``...`` (Ellipsis) statement.
145
136
 
146
- 8.1a1.dev0 (2025-03-20)
147
- -----------------------
148
137
 
149
- - Allow to use the package with Python 3.14 -- Caution: No security
150
- audit has been done so far.
138
+ 8.1 (2025-10-19)
139
+ ----------------
140
+
141
+ - Allow to use the package with Python 3.14 including t-string support.
151
142
 
152
143
 
153
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 = '8.1'
63
+ version = '8.2'
64
64
  # The full version, including alpha/beta/rc tags.
65
- release = '8.1'
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,7 +112,6 @@ 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),
@@ -98,7 +98,6 @@ 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
@@ -241,7 +240,6 @@ Technical Backgrounds - Links to External Documentation
241
240
  * `Python 3.12 AST`_ (EOL 2028-10)
242
241
  * `Python 3.11 AST`_ (EOL 2027-10)
243
242
  * `Python 3.10 AST`_ (EOL 2026-10)
244
- * `Python 3.9 AST`_ (EOL 2025-10)
245
243
 
246
244
  * `AST NodeVistiors Class`_
247
245
  * `AST NodeTransformer Class`_
@@ -269,8 +267,6 @@ Todos
269
267
 
270
268
  .. _`What's new in Python 3.10`: https://docs.python.org/3.10/whatsnew/3.10.html
271
269
 
272
- .. _`What's new in Python 3.9`: https://docs.python.org/3.9/whatsnew/3.9.html
273
-
274
270
  .. _`Status of Python Versions`: https://devguide.python.org/versions/
275
271
 
276
272
  .. _`Concept of Immutable Types and Python Example`: https://en.wikipedia.org/wiki/Immutable_object#Python
@@ -295,8 +291,6 @@ Todos
295
291
 
296
292
  .. _`Python 3.10 AST`: https://docs.python.org/3.10/library/ast.html#abstract-grammar
297
293
 
298
- .. _`Python 3.9 AST`: https://docs.python.org/3.9/library/ast.html#abstract-grammar
299
-
300
294
  .. _`AST NodeVistiors Class`: https://docs.python.org/3/library/ast.html#ast.NodeVisitor
301
295
 
302
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',
@@ -3,7 +3,6 @@ import sys
3
3
 
4
4
 
5
5
  _version = sys.version_info
6
- IS_PY310_OR_GREATER = _version.major == 3 and _version.minor >= 10
7
6
  IS_PY311_OR_GREATER = _version.major == 3 and _version.minor >= 11
8
7
  IS_PY312_OR_GREATER = _version.major == 3 and _version.minor >= 12
9
8
  IS_PY313_OR_GREATER = _version.major == 3 and _version.minor >= 13
@@ -356,60 +356,11 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
356
356
  return (tmp_target, cleanup)
357
357
 
358
358
  def gen_none_node(self):
359
- return ast.NameConstant(value=None)
359
+ return ast.Constant(None)
360
360
 
361
361
  def gen_del_stmt(self, name_to_del):
362
362
  return ast.Delete(targets=[ast.Name(name_to_del, ast.Del())])
363
363
 
364
- def transform_slice(self, slice_):
365
- """Transform slices into function parameters.
366
-
367
- ast.Slice nodes are only allowed within a ast.Subscript node.
368
- To use a slice as an argument of ast.Call it has to be converted.
369
- Conversion is done by calling the 'slice' function from builtins
370
- """
371
-
372
- if isinstance(slice_, ast.expr):
373
- # Python 3.9+
374
- return slice_
375
-
376
- elif isinstance(slice_, ast.Index):
377
- return slice_.value
378
-
379
- elif isinstance(slice_, ast.Slice):
380
- # Create a python slice object.
381
- args = []
382
-
383
- if slice_.lower:
384
- args.append(slice_.lower)
385
- else:
386
- args.append(self.gen_none_node())
387
-
388
- if slice_.upper:
389
- args.append(slice_.upper)
390
- else:
391
- args.append(self.gen_none_node())
392
-
393
- if slice_.step:
394
- args.append(slice_.step)
395
- else:
396
- args.append(self.gen_none_node())
397
-
398
- return ast.Call(
399
- func=ast.Name('slice', ast.Load()),
400
- args=args,
401
- keywords=[])
402
-
403
- elif isinstance(slice_, ast.ExtSlice):
404
- dims = ast.Tuple([], ast.Load())
405
- for item in slice_.dims:
406
- dims.elts.append(self.transform_slice(item))
407
- return dims
408
-
409
- else: # pragma: no cover
410
- # Index, Slice and ExtSlice are only defined Slice types.
411
- raise NotImplementedError(f"Unknown slice type: {slice_}")
412
-
413
364
  def check_name(self, node, name, allow_magic_methods=False):
414
365
  """Check names if they are allowed.
415
366
 
@@ -525,20 +476,12 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
525
476
  # ast for Literals
526
477
 
527
478
  def visit_Constant(self, node):
528
- """Allow constant literals with restriction for Ellipsis.
479
+ """Allow constant literals.
529
480
 
530
481
  Constant replaces Num, Str, Bytes, NameConstant and Ellipsis in
531
482
  Python 3.8+.
532
483
  :see: https://docs.python.org/dev/whatsnew/3.8.html#deprecated
533
484
  """
534
- if node.value is Ellipsis:
535
- # Deny using `...`.
536
- # Special handling necessary as ``self.not_allowed(node)``
537
- # would return the Error Message:
538
- # 'Constant statements are not allowed.'
539
- # which is only partial true.
540
- self.error(node, 'Ellipsis statements are not allowed.')
541
- return
542
485
  return self.node_contents_visit(node)
543
486
 
544
487
  def visit_Interactive(self, node):
@@ -932,7 +875,7 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
932
875
  if isinstance(node.ctx, ast.Load):
933
876
  new_node = ast.Call(
934
877
  func=ast.Name('_getitem_', ast.Load()),
935
- args=[node.value, self.transform_slice(node.slice)],
878
+ args=[node.value, node.slice],
936
879
  keywords=[])
937
880
 
938
881
  copy_locations(new_node, node)
@@ -953,24 +896,12 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
953
896
  raise NotImplementedError(
954
897
  f"Unknown ctx type: {type(node.ctx)}")
955
898
 
956
- def visit_Index(self, node):
957
- """
958
-
959
- """
960
- return self.node_contents_visit(node)
961
-
962
899
  def visit_Slice(self, node):
963
900
  """
964
901
 
965
902
  """
966
903
  return self.node_contents_visit(node)
967
904
 
968
- def visit_ExtSlice(self, node):
969
- """
970
-
971
- """
972
- return self.node_contents_visit(node)
973
-
974
905
  # Comprehensions
975
906
 
976
907
  def visit_ListComp(self, node):
@@ -1,21 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RestrictedPython
3
- Version: 8.1
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
@@ -23,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
23
21
  Classifier: Programming Language :: Python :: 3.14
24
22
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
23
  Classifier: Topic :: Security
26
- Requires-Python: >=3.9, <3.15
24
+ Requires-Python: <3.15,>=3.10
27
25
  Description-Content-Type: text/x-rst
28
26
  License-File: LICENSE.txt
29
27
  Provides-Extra: test
@@ -32,19 +30,7 @@ Requires-Dist: pytest-mock; extra == "test"
32
30
  Provides-Extra: docs
33
31
  Requires-Dist: Sphinx; extra == "docs"
34
32
  Requires-Dist: furo; extra == "docs"
35
- Dynamic: author
36
- Dynamic: author-email
37
- Dynamic: classifier
38
- Dynamic: description
39
- Dynamic: description-content-type
40
- Dynamic: home-page
41
- Dynamic: keywords
42
- Dynamic: license
43
33
  Dynamic: license-file
44
- Dynamic: project-url
45
- Dynamic: provides-extra
46
- Dynamic: requires-python
47
- Dynamic: summary
48
34
 
49
35
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
50
36
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -137,17 +123,22 @@ the documentation `Contributing page
137
123
  Changes
138
124
  =======
139
125
 
140
- 8.1 (2025-10-19)
126
+ 8.2 (2026-05-29)
141
127
  ----------------
142
128
 
143
- - Allow to use the package with Python 3.14 including t-string support.
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.
144
134
 
135
+ - Allow the ``...`` (Ellipsis) statement.
145
136
 
146
- 8.1a1.dev0 (2025-03-20)
147
- -----------------------
148
137
 
149
- - Allow to use the package with Python 3.14 -- Caution: No security
150
- audit has been done so far.
138
+ 8.1 (2025-10-19)
139
+ ----------------
140
+
141
+ - Allow to use the package with Python 3.14 including t-string support.
151
142
 
152
143
 
153
144
  8.0 (2025-01-23)