RestrictedPython 7.3__tar.gz → 8.0__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 (110) hide show
  1. restrictedpython-8.0/.pre-commit-config.yaml +28 -0
  2. {RestrictedPython-7.3 → restrictedpython-8.0}/CHANGES.rst +36 -1
  3. {RestrictedPython-7.3 → restrictedpython-8.0}/MANIFEST.in +1 -0
  4. {RestrictedPython-7.3 → restrictedpython-8.0}/PKG-INFO +42 -8
  5. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/conf.py +16 -9
  6. restrictedpython-8.0/docs/contributing/ast/python3_13.ast +194 -0
  7. restrictedpython-8.0/docs/contributing/changes_from312to313.rst +5 -0
  8. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/index.rst +6 -13
  9. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/index.rst +1 -3
  10. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/requirements.txt +1 -0
  11. restrictedpython-8.0/pyproject.toml +21 -0
  12. {RestrictedPython-7.3 → restrictedpython-8.0}/setup.cfg +1 -3
  13. {RestrictedPython-7.3 → restrictedpython-8.0}/setup.py +7 -13
  14. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/Guards.py +10 -5
  15. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/_compat.py +0 -1
  16. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/transformer.py +29 -83
  17. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/PKG-INFO +42 -8
  18. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/SOURCES.txt +4 -5
  19. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/requires.txt +1 -1
  20. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/builtins/test_utilities.py +0 -1
  21. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_Guards.py +12 -0
  22. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_NamedExpr.py +0 -3
  23. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_compile.py +1 -4
  24. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_compile_restricted_function.py +1 -6
  25. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_dict_comprehension.py +6 -16
  26. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_fstring.py +0 -7
  27. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_try.py +7 -13
  28. {RestrictedPython-7.3 → restrictedpython-8.0}/tox.ini +24 -46
  29. RestrictedPython-7.3/docs/contributing/ast/python3_6.ast +0 -175
  30. RestrictedPython-7.3/docs/contributing/ast/python3_7.ast +0 -175
  31. RestrictedPython-7.3/docs/contributing/changes_from36to37.rst +0 -5
  32. RestrictedPython-7.3/docs/contributing/changes_from37to38.rst +0 -5
  33. RestrictedPython-7.3/docs/upgrade_dependencies/index.rst +0 -30
  34. {RestrictedPython-7.3 → restrictedpython-8.0}/.readthedocs.yaml +0 -0
  35. {RestrictedPython-7.3 → restrictedpython-8.0}/CONTRIBUTING.md +0 -0
  36. {RestrictedPython-7.3 → restrictedpython-8.0}/COPYRIGHT.txt +0 -0
  37. {RestrictedPython-7.3 → restrictedpython-8.0}/LICENSE.txt +0 -0
  38. {RestrictedPython-7.3 → restrictedpython-8.0}/README.rst +0 -0
  39. {RestrictedPython-7.3 → restrictedpython-8.0}/buildout.cfg +0 -0
  40. {RestrictedPython-7.3 → restrictedpython-8.0}/constraints.txt +0 -0
  41. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/Makefile +0 -0
  42. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/changes.rst +0 -0
  43. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/ast/python3_10.ast +0 -0
  44. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/ast/python3_11.ast +0 -0
  45. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/ast/python3_12.ast +0 -0
  46. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/ast/python3_8.ast +0 -0
  47. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/ast/python3_9.ast +0 -0
  48. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/changes_from310to311.rst +0 -0
  49. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/changes_from311to312.rst +0 -0
  50. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/changes_from38to39.rst +0 -0
  51. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/contributing/changes_from39to310.rst +0 -0
  52. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/idea.rst +0 -0
  53. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/install/index.rst +0 -0
  54. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/logo.jpg +0 -0
  55. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/make.bat +0 -0
  56. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/roadmap/index.rst +0 -0
  57. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/usage/api.rst +0 -0
  58. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/usage/basic_usage.rst +0 -0
  59. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/usage/framework_usage.rst +0 -0
  60. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/usage/index.rst +0 -0
  61. {RestrictedPython-7.3 → restrictedpython-8.0}/docs/usage/policy.rst +0 -0
  62. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/Eval.py +0 -0
  63. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/Limits.py +0 -0
  64. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/PrintCollector.py +0 -0
  65. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/Utilities.py +0 -0
  66. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/__init__.py +0 -0
  67. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython/compile.py +0 -0
  68. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/dependency_links.txt +0 -0
  69. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/not-zip-safe +0 -0
  70. {RestrictedPython-7.3 → restrictedpython-8.0}/src/RestrictedPython.egg-info/top_level.txt +0 -0
  71. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/__init__.py +0 -0
  72. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/builtins/test_limits.py +0 -0
  73. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/helper.py +0 -0
  74. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_Utilities.py +0 -0
  75. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_eval.py +0 -0
  76. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_imports.py +0 -0
  77. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_iterating_over_dict_items.py +0 -0
  78. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/test_print_function.py +0 -0
  79. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_arithmetic_operators.py +0 -0
  80. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_bit_wise_operators.py +0 -0
  81. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_bool_operators.py +0 -0
  82. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_comparison_operators.py +0 -0
  83. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_identity_operators.py +0 -0
  84. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_logical_operators.py +0 -0
  85. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/operators/test_unary_operators.py +0 -0
  86. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_assert.py +0 -0
  87. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_assign.py +0 -0
  88. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_async.py +0 -0
  89. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_attribute.py +0 -0
  90. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_augassign.py +0 -0
  91. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_base_types.py +0 -0
  92. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_breakpoint.py +0 -0
  93. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_call.py +0 -0
  94. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_classdef.py +0 -0
  95. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_comparators.py +0 -0
  96. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_conditional.py +0 -0
  97. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_eval_exec.py +0 -0
  98. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_functiondef.py +0 -0
  99. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_generic.py +0 -0
  100. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_global_local.py +0 -0
  101. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_import.py +0 -0
  102. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_inspect.py +0 -0
  103. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_iterator.py +0 -0
  104. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_lambda.py +0 -0
  105. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_loop.py +0 -0
  106. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_name.py +0 -0
  107. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_slice.py +0 -0
  108. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_subscript.py +0 -0
  109. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_with_stmt.py +0 -0
  110. {RestrictedPython-7.3 → restrictedpython-8.0}/tests/transformer/test_yield.py +0 -0
@@ -0,0 +1,28 @@
1
+ # Generated from:
2
+ # https://github.com/zopefoundation/meta/tree/master/config/pure-python
3
+ minimum_pre_commit_version: '3.6'
4
+ repos:
5
+ - repo: https://github.com/pycqa/isort
6
+ rev: "5.13.2"
7
+ hooks:
8
+ - id: isort
9
+ - repo: https://github.com/hhatto/autopep8
10
+ rev: "v2.3.1"
11
+ hooks:
12
+ - id: autopep8
13
+ args: [--in-place, --aggressive, --aggressive]
14
+ - repo: https://github.com/asottile/pyupgrade
15
+ rev: v3.19.0
16
+ hooks:
17
+ - id: pyupgrade
18
+ args: [--py39-plus]
19
+ - repo: https://github.com/isidentical/teyit
20
+ rev: 0.4.3
21
+ hooks:
22
+ - id: teyit
23
+ - repo: https://github.com/PyCQA/flake8
24
+ rev: "7.1.1"
25
+ hooks:
26
+ - id: flake8
27
+ additional_dependencies:
28
+ - flake8-debugger == 4.1.2
@@ -1,6 +1,41 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ 8.0 (2025-01-23)
5
+ ----------------
6
+
7
+ Backwards incompatible changes
8
+ ++++++++++++++++++++++++++++++
9
+
10
+ - Disallow ``try/except*`` clauses due to a possible sandbox escape and
11
+ probable uselessness of this feature in the context of ``RestrictedPython``.
12
+ In addition, remove ``ExceptionGroup`` from ``safe_builtins`` (as useful only
13
+ with ``try/except*``). - This feature was introduced into
14
+ ``RestrictedPython`` in version 6.0 for Python 3.11+. (CVE-2025-22153)
15
+
16
+ - Drop support for Python 3.8.
17
+
18
+ Features
19
+ ++++++++
20
+
21
+ - Update setuptools version pin.
22
+ (`#292 <https://github.com/zopefoundation/RestrictedPython/issues/292>`_)
23
+
24
+
25
+ 7.4 (2024-10-09)
26
+ ----------------
27
+
28
+ - Allow to use the package with Python 3.13.
29
+
30
+ - Drop support for Python 3.7.
31
+
32
+ - Provide new function ``RestrictedPython.Guards.safer_getattr_raise``.
33
+ It is similar to ``safer_getattr`` but handles its parameter
34
+ ``default`` like ``getattr``, i.e. it raises ``AttributeError``
35
+ if the attribute lookup fails and this parameter is not provided,
36
+ fixes `#287 <https://github.com/zopefoundation/RestrictedPython/issues/287>`_.
37
+
38
+
4
39
  7.3 (2024-09-30)
5
40
  ----------------
6
41
 
@@ -9,7 +44,7 @@ Changes
9
44
  and give the same level of protection as direct attribute access in an
10
45
  environment based on ``RestrictedPython``'s ``safe_builtints``.
11
46
  - Prevent information leakage via ``AttributeError.obj``
12
- and the ``string`` module.
47
+ and the ``string`` module. (CVE-2024-47532)
13
48
 
14
49
 
15
50
  7.2 (2024-08-02)
@@ -5,6 +5,7 @@ include *.rst
5
5
  include *.txt
6
6
  include buildout.cfg
7
7
  include tox.ini
8
+ include .pre-commit-config.yaml
8
9
 
9
10
  recursive-include docs *.py
10
11
  recursive-include docs *.rst
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RestrictedPython
3
- Version: 7.3
3
+ Version: 8.0
4
4
  Summary: RestrictedPython is a defined subset of the Python language which allows to provide a program input into a trusted environment.
5
5
  Home-page: https://github.com/zopefoundation/RestrictedPython
6
6
  Author: Zope Foundation and Contributors
7
- Author-email: zope-dev@zope.org
8
- License: ZPL 2.1
7
+ Author-email: zope-dev@zope.dev
8
+ License: ZPL-2.1
9
9
  Project-URL: Documentation, https://restrictedpython.readthedocs.io/
10
10
  Project-URL: Source, https://github.com/zopefoundation/RestrictedPython
11
11
  Project-URL: Tracker, https://github.com/zopefoundation/RestrictedPython/issues
@@ -15,15 +15,14 @@ Classifier: License :: OSI Approved :: Zope Public License
15
15
  Classifier: Programming Language :: Python
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
- Classifier: Programming Language :: Python :: 3.8
20
18
  Classifier: Programming Language :: Python :: 3.9
21
19
  Classifier: Programming Language :: Python :: 3.10
22
20
  Classifier: Programming Language :: Python :: 3.11
23
21
  Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
24
23
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
24
  Classifier: Topic :: Security
26
- Requires-Python: >=3.7, <3.13
25
+ Requires-Python: >=3.9, <3.14
27
26
  Description-Content-Type: text/x-rst
28
27
  License-File: LICENSE.txt
29
28
  Provides-Extra: test
@@ -31,7 +30,7 @@ Requires-Dist: pytest; extra == "test"
31
30
  Requires-Dist: pytest-mock; extra == "test"
32
31
  Provides-Extra: docs
33
32
  Requires-Dist: Sphinx; extra == "docs"
34
- Requires-Dist: sphinx_rtd_theme; extra == "docs"
33
+ Requires-Dist: furo; extra == "docs"
35
34
 
36
35
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
37
36
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -124,6 +123,41 @@ the documentation `Contributing page
124
123
  Changes
125
124
  =======
126
125
 
126
+ 8.0 (2025-01-23)
127
+ ----------------
128
+
129
+ Backwards incompatible changes
130
+ ++++++++++++++++++++++++++++++
131
+
132
+ - Disallow ``try/except*`` clauses due to a possible sandbox escape and
133
+ probable uselessness of this feature in the context of ``RestrictedPython``.
134
+ In addition, remove ``ExceptionGroup`` from ``safe_builtins`` (as useful only
135
+ with ``try/except*``). - This feature was introduced into
136
+ ``RestrictedPython`` in version 6.0 for Python 3.11+. (CVE-2025-22153)
137
+
138
+ - Drop support for Python 3.8.
139
+
140
+ Features
141
+ ++++++++
142
+
143
+ - Update setuptools version pin.
144
+ (`#292 <https://github.com/zopefoundation/RestrictedPython/issues/292>`_)
145
+
146
+
147
+ 7.4 (2024-10-09)
148
+ ----------------
149
+
150
+ - Allow to use the package with Python 3.13.
151
+
152
+ - Drop support for Python 3.7.
153
+
154
+ - Provide new function ``RestrictedPython.Guards.safer_getattr_raise``.
155
+ It is similar to ``safer_getattr`` but handles its parameter
156
+ ``default`` like ``getattr``, i.e. it raises ``AttributeError``
157
+ if the attribute lookup fails and this parameter is not provided,
158
+ fixes `#287 <https://github.com/zopefoundation/RestrictedPython/issues/287>`_.
159
+
160
+
127
161
  7.3 (2024-09-30)
128
162
  ----------------
129
163
 
@@ -132,7 +166,7 @@ Changes
132
166
  and give the same level of protection as direct attribute access in an
133
167
  environment based on ``RestrictedPython``'s ``safe_builtints``.
134
168
  - Prevent information leakage via ``AttributeError.obj``
135
- and the ``string`` module.
169
+ and the ``string`` module. (CVE-2024-47532)
136
170
 
137
171
 
138
172
  7.2 (2024-08-02)
@@ -16,8 +16,13 @@
16
16
  # documentation root, use os.path.abspath to make it absolute, like shown here.
17
17
  # sys.path.insert(0, os.path.abspath('.'))
18
18
 
19
+ import datetime
20
+
21
+
19
22
  # -- General configuration ------------------------------------------------
20
23
 
24
+ year = datetime.datetime.now().year
25
+
21
26
  # If your documentation needs a minimal Sphinx version, state it here.
22
27
  # needs_sphinx = '1.0'
23
28
 
@@ -37,7 +42,7 @@ templates_path = ['_templates']
37
42
  # The suffix(es) of source filenames.
38
43
  # You can specify multiple suffix as a list of string:
39
44
  # source_suffix = ['.rst', '.md']
40
- source_suffix = '.rst'
45
+ source_suffix = {'.rst': 'restructuredtext'}
41
46
 
42
47
  # The encoding of source files.
43
48
  # source_encoding = 'utf-8-sig'
@@ -47,7 +52,7 @@ master_doc = 'index'
47
52
 
48
53
  # General information about the project.
49
54
  project = 'RestrictedPython'
50
- copyright = '2017-2023, Zope Foundation and Contributors'
55
+ copyright = f'2017-{year}, Zope Foundation and Contributors'
51
56
  author = 'The Zope & Plone developer community'
52
57
 
53
58
  # The version info for the project you're documenting, acts as replacement for
@@ -55,9 +60,9 @@ author = 'The Zope & Plone developer community'
55
60
  # built documents.
56
61
  #
57
62
  # The short X.Y version.
58
- version = '7.0'
63
+ version = '7.5'
59
64
  # The full version, including alpha/beta/rc tags.
60
- release = '7.0'
65
+ release = '7.5'
61
66
 
62
67
  # The language for content autogenerated by Sphinx. Refer to documentation
63
68
  # for a list of supported languages.
@@ -107,12 +112,11 @@ todo_include_todos = True
107
112
  # Intersphinx Mapping for Links between different Documentations
108
113
  intersphinx_mapping = {
109
114
  'python3': ('https://docs.python.org/3', None),
110
- 'python37': ('https://docs.python.org/3.7', None),
111
- 'python38': ('https://docs.python.org/3.8', None),
112
115
  'python39': ('https://docs.python.org/3.9', None),
113
116
  'python310': ('https://docs.python.org/3.10', None),
114
117
  'python311': ('https://docs.python.org/3.11', None),
115
118
  'python312': ('https://docs.python.org/3.12', None),
119
+ 'python313': ('https://docs.python.org/3.13', None),
116
120
  }
117
121
 
118
122
  # Options for sphinx.ext.todo:
@@ -123,7 +127,7 @@ todo_emit_warnings = True
123
127
 
124
128
  # The theme to use for HTML and HTML Help pages. See the documentation for
125
129
  # a list of builtin themes.
126
- html_theme = 'default'
130
+ html_theme = 'furo'
127
131
 
128
132
  # Theme options are theme-specific and customize the look and feel of a theme
129
133
  # further. For a list of options available for each theme, see the
@@ -274,8 +278,11 @@ latex_documents = [
274
278
  # One entry per manual page. List of tuples
275
279
  # (source start file, name, description, authors, manual section).
276
280
  man_pages = [
277
- (master_doc, 'restrictedpython', 'RestrictedPython Documentation', [author], 1)
278
- ]
281
+ (master_doc,
282
+ 'restrictedpython',
283
+ 'RestrictedPython Documentation',
284
+ [author],
285
+ 1)]
279
286
 
280
287
  # If true, show URL addresses after external links.
281
288
  # man_show_urls = False
@@ -0,0 +1,194 @@
1
+ -- Python 3.13 AST
2
+ -- ASDL's 4 builtin types are:
3
+ -- identifier, int, string, constant
4
+
5
+ module Python version "3.13"
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
+ | JoinedStr(expr* values)
93
+ | Constant(constant value, string? kind)
94
+
95
+ -- the following expression can appear in assignment context
96
+ | Attribute(expr value, identifier attr, expr_context ctx)
97
+ | Subscript(expr value, expr slice, expr_context ctx)
98
+ | Starred(expr value, expr_context ctx)
99
+ | Name(identifier id, expr_context ctx)
100
+ | List(expr* elts, expr_context ctx)
101
+ | Tuple(expr* elts, expr_context ctx)
102
+
103
+ -- can appear only in Subscript
104
+ | Slice(expr? lower, expr? upper, expr? step)
105
+
106
+ -- col_offset is the byte offset in the utf8 string the parser uses
107
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
108
+
109
+ expr_context = Load
110
+ | Store
111
+ | Del
112
+
113
+ boolop = And
114
+ | Or
115
+
116
+ operator = Add
117
+ | Sub
118
+ | Mult
119
+ | MatMult
120
+ | Div
121
+ | Mod
122
+ | Pow
123
+ | LShift
124
+ | RShift
125
+ | BitOr
126
+ | BitXor
127
+ | BitAnd
128
+ | FloorDiv
129
+
130
+ unaryop = Invert
131
+ | Not
132
+ | UAdd
133
+ | USub
134
+
135
+ cmpop = Eq
136
+ | NotEq
137
+ | Lt
138
+ | LtE
139
+ | Gt
140
+ | GtE
141
+ | Is
142
+ | IsNot
143
+ | In
144
+ | NotIn
145
+
146
+ comprehension = (expr target, expr iter, expr* ifs, int is_async)
147
+
148
+ excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)
149
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
150
+
151
+ arguments = (arg* posonlyargs,
152
+ arg* args,
153
+ arg? vararg,
154
+ arg* kwonlyargs,
155
+ expr* kw_defaults,
156
+ arg? kwarg,
157
+ expr* defaults)
158
+
159
+ arg = (identifier arg, expr? annotation, string? type_comment)
160
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
161
+
162
+ -- keyword arguments supplied to call (NULL identifier for **kwargs)
163
+ keyword = (identifier? arg, expr value)
164
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
165
+
166
+ -- import name with optional 'as' alias.
167
+ alias = (identifier name, identifier? asname)
168
+ attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset)
169
+
170
+ withitem = (expr context_expr, expr? optional_vars)
171
+
172
+ match_case = (pattern pattern, expr? guard, stmt* body)
173
+
174
+ pattern = MatchValue(expr value)
175
+ | MatchSingleton(constant value)
176
+ | MatchSequence(pattern* patterns)
177
+ | MatchMapping(expr* keys, pattern* patterns, identifier? rest)
178
+ | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, pattern* kwd_patterns)
179
+
180
+ | MatchStar(identifier? name)
181
+ -- The optional "rest" MatchMapping parameter handles capturing extra mapping keys
182
+
183
+ | MatchAs(pattern? pattern, identifier? name)
184
+ | MatchOr(pattern* patterns)
185
+
186
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
187
+
188
+ type_ignore = TypeIgnore(int lineno, string tag)
189
+
190
+ type_param = TypeVar(identifier name, expr? bound, expr? default_value)
191
+ | ParamSpec(identifier name, expr? default_value)
192
+ | TypeVarTuple(identifier name, expr? default_value)
193
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
194
+ }
@@ -0,0 +1,5 @@
1
+ Changes from Python 3.12 to Python 3.13
2
+ ---------------------------------------
3
+
4
+ .. literalinclude:: ast/python3_13.ast
5
+ :diff: ast/python3_12.ast
@@ -1,7 +1,6 @@
1
1
  Contributing
2
2
  ============
3
3
 
4
- .. contents::
5
4
 
6
5
  Contributing to RestrictedPython
7
6
  --------------------------------
@@ -99,12 +98,11 @@ A (modified style) Copy of all Abstract Grammar Definitions for the Python versi
99
98
  .. toctree::
100
99
  :maxdepth: 2
101
100
 
102
- changes_from36to37
103
- changes_from37to38
104
101
  changes_from38to39
105
102
  changes_from39to310
106
103
  changes_from310to311
107
104
  changes_from311to312
105
+ changes_from312to313
108
106
 
109
107
  .. _understand:
110
108
 
@@ -237,12 +235,11 @@ Technical Backgrounds - Links to External Documentation
237
235
 
238
236
  * AST Grammar of Python (`Status of Python Versions`_)
239
237
 
238
+ * `Python 3.13 AST`_ (EOL 2029-10)
240
239
  * `Python 3.12 AST`_ (EOL 2028-10)
241
240
  * `Python 3.11 AST`_ (EOL 2027-10)
242
241
  * `Python 3.10 AST`_ (EOL 2026-10)
243
242
  * `Python 3.9 AST`_ (EOL 2025-10)
244
- * `Python 3.8 AST`_ (EOL 2024-10)
245
- * `Python 3.7 AST`_ (EOL 2023-06-27)
246
243
 
247
244
  * `AST NodeVistiors Class`_
248
245
  * `AST NodeTransformer Class`_
@@ -260,6 +257,8 @@ Todos
260
257
 
261
258
  .. _`What's new in Python`: https://docs.python.org/3/whatsnew/
262
259
 
260
+ .. _`What's new in Python 3.13`: https://docs.python.org/3.13/whatsnew/3.13.html
261
+
263
262
  .. _`What's new in Python 3.12`: https://docs.python.org/3.12/whatsnew/3.12.html
264
263
 
265
264
  .. _`What's new in Python 3.11`: https://docs.python.org/3.11/whatsnew/3.11.html
@@ -268,10 +267,6 @@ Todos
268
267
 
269
268
  .. _`What's new in Python 3.9`: https://docs.python.org/3.9/whatsnew/3.9.html
270
269
 
271
- .. _`What's new in Python 3.8`: https://docs.python.org/3.8/whatsnew/3.8.html
272
-
273
- .. _`What's new in Python 3.7`: https://docs.python.org/3.7/whatsnew/3.7.html
274
-
275
270
  .. _`Status of Python Versions`: https://devguide.python.org/versions/
276
271
 
277
272
  .. _`Concept of Immutable Types and Python Example`: https://en.wikipedia.org/wiki/Immutable_object#Python
@@ -286,6 +281,8 @@ Todos
286
281
 
287
282
  .. _`Python 3 AST`: https://docs.python.org/3/library/ast.html#abstract-grammar
288
283
 
284
+ .. _`Python 3.13 AST`: https://docs.python.org/3.13/library/ast.html#abstract-grammar
285
+
289
286
  .. _`Python 3.12 AST`: https://docs.python.org/3.12/library/ast.html#abstract-grammar
290
287
 
291
288
  .. _`Python 3.11 AST`: https://docs.python.org/3.11/library/ast.html#abstract-grammar
@@ -294,10 +291,6 @@ Todos
294
291
 
295
292
  .. _`Python 3.9 AST`: https://docs.python.org/3.9/library/ast.html#abstract-grammar
296
293
 
297
- .. _`Python 3.8 AST`: https://docs.python.org/3.8/library/ast.html#abstract-grammar
298
-
299
- .. _`Python 3.7 AST`: https://docs.python.org/3.7/library/ast.html#abstract-grammar
300
-
301
294
  .. _`AST NodeVistiors Class`: https://docs.python.org/3/library/ast.html#ast.NodeVisitor
302
295
 
303
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.7 up to 3.12.
18
+ RestrictedPython supports CPython 3.9 up to 3.13.
19
19
  It does _not_ support PyPy or other alternative Python implementations.
20
20
 
21
21
  Contents
@@ -29,8 +29,6 @@ Contents
29
29
  usage/index
30
30
  usage/api
31
31
 
32
- upgrade_dependencies/index
33
-
34
32
  roadmap/index
35
33
  contributing/index
36
34
 
@@ -0,0 +1,21 @@
1
+ #
2
+ # Generated from:
3
+ # https://github.com/zopefoundation/meta/tree/master/config/pure-python
4
+
5
+ [build-system]
6
+ requires = ["setuptools <= 75.6.0"]
7
+ build-backend = "setuptools.build_meta"
8
+
9
+ [tool.coverage.run]
10
+ branch = true
11
+ source = ["RestrictedPython"]
12
+
13
+ [tool.coverage.report]
14
+ fail_under = 97.3
15
+ precision = 2
16
+ ignore_errors = true
17
+ show_missing = true
18
+ exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]
19
+
20
+ [tool.coverage.html]
21
+ directory = "parts/htmlcov"
@@ -1,6 +1,3 @@
1
- [bdist_wheel]
2
- universal = 0
3
-
4
1
  [flake8]
5
2
  doctests = 1
6
3
 
@@ -17,6 +14,7 @@ ignore =
17
14
  docs/_build/html/_sources/roadmap/*
18
15
  docs/_build/html/_sources/upgrade_dependencies/*
19
16
  docs/_build/html/_sources/usage/*
17
+ docs/_build/html/_static/scripts/*
20
18
 
21
19
  [isort]
22
20
  force_single_line = True
@@ -24,15 +24,10 @@ def read(*rnames):
24
24
  return f.read()
25
25
 
26
26
 
27
- tests_require = [
28
- 'pytest',
29
- 'pytest-mock',
30
- ]
31
-
32
27
  setup(name='RestrictedPython',
33
- version='7.3',
28
+ version='8.0',
34
29
  url='https://github.com/zopefoundation/RestrictedPython',
35
- license='ZPL 2.1',
30
+ license='ZPL-2.1',
36
31
  description=(
37
32
  'RestrictedPython is a defined subset of the Python language which '
38
33
  'allows to provide a program input into a trusted environment.'),
@@ -44,18 +39,17 @@ setup(name='RestrictedPython',
44
39
  'Programming Language :: Python',
45
40
  'Operating System :: OS Independent',
46
41
  'Programming Language :: Python :: 3',
47
- 'Programming Language :: Python :: 3.7',
48
- 'Programming Language :: Python :: 3.8',
49
42
  'Programming Language :: Python :: 3.9',
50
43
  'Programming Language :: Python :: 3.10',
51
44
  'Programming Language :: Python :: 3.11',
52
45
  'Programming Language :: Python :: 3.12',
46
+ 'Programming Language :: Python :: 3.13',
53
47
  'Programming Language :: Python :: Implementation :: CPython',
54
48
  'Topic :: Security',
55
49
  ],
56
50
  keywords='restricted execution security untrusted code',
57
51
  author='Zope Foundation and Contributors',
58
- author_email='zope-dev@zope.org',
52
+ author_email='zope-dev@zope.dev',
59
53
  project_urls={
60
54
  "Documentation": "https://restrictedpython.readthedocs.io/",
61
55
  "Source": "https://github.com/zopefoundation/RestrictedPython",
@@ -65,10 +59,10 @@ setup(name='RestrictedPython',
65
59
  packages=find_packages('src'),
66
60
  package_dir={'': 'src'},
67
61
  install_requires=[],
68
- python_requires=">=3.7, <3.13",
62
+ python_requires=">=3.9, <3.14",
69
63
  extras_require={
70
- 'test': tests_require,
71
- 'docs': ['Sphinx', 'sphinx_rtd_theme'],
64
+ 'test': ['pytest', 'pytest-mock'],
65
+ 'docs': ['Sphinx', 'furo'],
72
66
  },
73
67
  include_package_data=True,
74
68
  zip_safe=False)