RestrictedPython 7.0a1.dev1__tar.gz → 7.1__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 (106) hide show
  1. RestrictedPython-7.1/.readthedocs.yaml +25 -0
  2. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/CHANGES.rst +10 -6
  3. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/MANIFEST.in +1 -0
  4. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/PKG-INFO +17 -8
  5. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/conf.py +5 -5
  6. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_12.ast +12 -3
  7. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/index.rst +14 -14
  8. RestrictedPython-7.1/docs/requirements.txt +1 -0
  9. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/roadmap/index.rst +0 -5
  10. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/setup.py +2 -1
  11. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/transformer.py +2 -2
  12. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/PKG-INFO +17 -8
  13. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/SOURCES.txt +2 -0
  14. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_arithmetic_operators.py +9 -6
  15. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tox.ini +26 -10
  16. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/CONTRIBUTING.md +0 -0
  17. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/COPYRIGHT.txt +0 -0
  18. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/LICENSE.txt +0 -0
  19. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/README.rst +0 -0
  20. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/buildout.cfg +0 -0
  21. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/constraints.txt +0 -0
  22. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/Makefile +0 -0
  23. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/changes.rst +0 -0
  24. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_10.ast +0 -0
  25. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_11.ast +0 -0
  26. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_6.ast +0 -0
  27. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_7.ast +0 -0
  28. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_8.ast +0 -0
  29. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/ast/python3_9.ast +0 -0
  30. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from310to311.rst +0 -0
  31. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from311to312.rst +0 -0
  32. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from36to37.rst +0 -0
  33. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from37to38.rst +0 -0
  34. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from38to39.rst +0 -0
  35. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/contributing/changes_from39to310.rst +0 -0
  36. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/idea.rst +0 -0
  37. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/index.rst +0 -0
  38. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/install/index.rst +0 -0
  39. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/logo.jpg +0 -0
  40. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/make.bat +0 -0
  41. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/upgrade_dependencies/index.rst +0 -0
  42. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/usage/api.rst +0 -0
  43. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/usage/basic_usage.rst +0 -0
  44. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/usage/framework_usage.rst +0 -0
  45. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/usage/index.rst +0 -0
  46. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/docs/usage/policy.rst +0 -0
  47. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/setup.cfg +0 -0
  48. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/Eval.py +0 -0
  49. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/Guards.py +0 -0
  50. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/Limits.py +0 -0
  51. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/PrintCollector.py +0 -0
  52. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/Utilities.py +0 -0
  53. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/__init__.py +0 -0
  54. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/_compat.py +0 -0
  55. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython/compile.py +0 -0
  56. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/dependency_links.txt +0 -0
  57. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/not-zip-safe +0 -0
  58. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/requires.txt +0 -0
  59. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/src/RestrictedPython.egg-info/top_level.txt +0 -0
  60. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/__init__.py +0 -0
  61. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/builtins/test_limits.py +0 -0
  62. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/builtins/test_utilities.py +0 -0
  63. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/helper.py +0 -0
  64. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_Guards.py +0 -0
  65. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_NamedExpr.py +0 -0
  66. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_Utilities.py +0 -0
  67. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_compile.py +0 -0
  68. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_compile_restricted_function.py +0 -0
  69. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_eval.py +0 -0
  70. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_imports.py +0 -0
  71. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_iterating_over_dict_items.py +0 -0
  72. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/test_print_function.py +0 -0
  73. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_bit_wise_operators.py +0 -0
  74. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_bool_operators.py +0 -0
  75. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_comparison_operators.py +0 -0
  76. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_identity_operators.py +0 -0
  77. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_logical_operators.py +0 -0
  78. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/operators/test_unary_operators.py +0 -0
  79. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_assert.py +0 -0
  80. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_assign.py +0 -0
  81. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_async.py +0 -0
  82. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_attribute.py +0 -0
  83. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_augassign.py +0 -0
  84. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_base_types.py +0 -0
  85. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_breakpoint.py +0 -0
  86. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_call.py +0 -0
  87. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_classdef.py +0 -0
  88. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_comparators.py +0 -0
  89. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_conditional.py +0 -0
  90. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_dict_comprehension.py +0 -0
  91. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_eval_exec.py +0 -0
  92. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_fstring.py +0 -0
  93. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_functiondef.py +0 -0
  94. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_generic.py +0 -0
  95. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_global_local.py +0 -0
  96. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_import.py +0 -0
  97. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_inspect.py +0 -0
  98. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_iterator.py +0 -0
  99. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_lambda.py +0 -0
  100. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_loop.py +0 -0
  101. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_name.py +0 -0
  102. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_slice.py +0 -0
  103. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_subscript.py +0 -0
  104. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_try.py +0 -0
  105. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_with_stmt.py +0 -0
  106. {RestrictedPython-7.0a1.dev1 → RestrictedPython-7.1}/tests/transformer/test_yield.py +0 -0
@@ -0,0 +1,25 @@
1
+ # Generated from:
2
+ # https://github.com/zopefoundation/meta/tree/master/config/pure-python
3
+ # Read the Docs configuration file
4
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
5
+
6
+ # Required
7
+ version: 2
8
+
9
+ # Set the version of Python and other tools you might need
10
+ build:
11
+ os: ubuntu-22.04
12
+ tools:
13
+ python: "3.11"
14
+
15
+ # Build documentation in the docs/ directory with Sphinx
16
+ sphinx:
17
+ configuration: docs/conf.py
18
+
19
+ # We recommend specifying your dependencies to enable reproducible builds:
20
+ # https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
21
+ python:
22
+ install:
23
+ - requirements: docs/requirements.txt
24
+ - method: pip
25
+ path: .
@@ -1,8 +1,14 @@
1
1
  Changes
2
2
  =======
3
3
 
4
- 7.0a1.dev1 (2023-09-06)
5
- -----------------------
4
+ 7.1 (2024-03-14)
5
+ ----------------
6
+
7
+ - Add support for the matmul (``@``) operator.
8
+
9
+
10
+ 7.0 (2023-11-17)
11
+ ----------------
6
12
 
7
13
  Backwards incompatible changes
8
14
  ++++++++++++++++++++++++++++++
@@ -12,8 +18,7 @@ Backwards incompatible changes
12
18
  Features
13
19
  ++++++++
14
20
 
15
- - Allow to use the package with Python 3.12 -- Caution: No security audit has
16
- been done so far.
21
+ - Officially support Python 3.12.
17
22
 
18
23
  Fixes
19
24
  +++++
@@ -23,8 +28,7 @@ Fixes
23
28
  - Forbid using some attributes providing access to restricted Python internals.
24
29
  (CVE-2023-37271)
25
30
 
26
- - Fix information disclosure problems through
27
- Python's "format" functionality
31
+ - Fix information disclosure problems through Python's "format" functionality
28
32
  (``format`` and ``format_map`` methods on ``str`` and its instances,
29
33
  ``string.Formatter``). (CVE-2023-41039)
30
34
 
@@ -12,6 +12,7 @@ recursive-include docs *.txt
12
12
  recursive-include docs Makefile
13
13
 
14
14
  recursive-include src *.py
15
+ include *.yaml
15
16
  recursive-include docs *.ast
16
17
  recursive-include docs *.bat
17
18
  recursive-include docs *.jpg
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RestrictedPython
3
- Version: 7.0a1.dev1
3
+ Version: 7.1
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
@@ -20,13 +20,18 @@ Classifier: Programming Language :: Python :: 3.8
20
20
  Classifier: Programming Language :: Python :: 3.9
21
21
  Classifier: Programming Language :: Python :: 3.10
22
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Topic :: Security
25
26
  Requires-Python: >=3.7, <3.13
26
27
  Description-Content-Type: text/x-rst
28
+ License-File: LICENSE.txt
27
29
  Provides-Extra: test
30
+ Requires-Dist: pytest; extra == "test"
31
+ Requires-Dist: pytest-mock; extra == "test"
28
32
  Provides-Extra: docs
29
- License-File: LICENSE.txt
33
+ Requires-Dist: Sphinx; extra == "docs"
34
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
30
35
 
31
36
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
32
37
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -119,8 +124,14 @@ the documentation `Contributing page
119
124
  Changes
120
125
  =======
121
126
 
122
- 7.0a1.dev1 (2023-09-06)
123
- -----------------------
127
+ 7.1 (2024-03-14)
128
+ ----------------
129
+
130
+ - Add support for the matmul (``@``) operator.
131
+
132
+
133
+ 7.0 (2023-11-17)
134
+ ----------------
124
135
 
125
136
  Backwards incompatible changes
126
137
  ++++++++++++++++++++++++++++++
@@ -130,8 +141,7 @@ Backwards incompatible changes
130
141
  Features
131
142
  ++++++++
132
143
 
133
- - Allow to use the package with Python 3.12 -- Caution: No security audit has
134
- been done so far.
144
+ - Officially support Python 3.12.
135
145
 
136
146
  Fixes
137
147
  +++++
@@ -141,8 +151,7 @@ Fixes
141
151
  - Forbid using some attributes providing access to restricted Python internals.
142
152
  (CVE-2023-37271)
143
153
 
144
- - Fix information disclosure problems through
145
- Python's "format" functionality
154
+ - Fix information disclosure problems through Python's "format" functionality
146
155
  (``format`` and ``format_map`` methods on ``str`` and its instances,
147
156
  ``string.Formatter``). (CVE-2023-41039)
148
157
 
@@ -47,7 +47,7 @@ master_doc = 'index'
47
47
 
48
48
  # General information about the project.
49
49
  project = 'RestrictedPython'
50
- copyright = '2017-2022, Zope Foundation and Contributors'
50
+ copyright = '2017-2023, Zope Foundation and Contributors'
51
51
  author = 'The Zope & Plone developer community'
52
52
 
53
53
  # The version info for the project you're documenting, acts as replacement for
@@ -55,9 +55,9 @@ author = 'The Zope & Plone developer community'
55
55
  # built documents.
56
56
  #
57
57
  # The short X.Y version.
58
- version = '5.0'
58
+ version = '7.0'
59
59
  # The full version, including alpha/beta/rc tags.
60
- release = '5.0'
60
+ release = '7.0'
61
61
 
62
62
  # The language for content autogenerated by Sphinx. Refer to documentation
63
63
  # for a list of supported languages.
@@ -123,7 +123,7 @@ todo_emit_warnings = True
123
123
 
124
124
  # The theme to use for HTML and HTML Help pages. See the documentation for
125
125
  # a list of builtin themes.
126
- html_theme = 'sphinx_rtd_theme'
126
+ html_theme = 'default'
127
127
 
128
128
  # Theme options are theme-specific and customize the look and feel of a theme
129
129
  # further. For a list of options available for each theme, see the
@@ -217,7 +217,7 @@ html_theme = 'sphinx_rtd_theme'
217
217
  # html_search_scorer = 'scorer.js'
218
218
 
219
219
  # Output file base name for HTML help builder.
220
- htmlhelp_basename = 'RestrictedPythondoc'
220
+ htmlhelp_basename = 'RestrictedPython_doc'
221
221
 
222
222
  # -- Options for LaTeX output ---------------------------------------------
223
223
 
@@ -14,23 +14,27 @@ module Python version "3.12"
14
14
  stmt* body,
15
15
  expr* decorator_list,
16
16
  expr? returns,
17
- string? type_comment)
17
+ string? type_comment,
18
+ type_param* type_params)
18
19
  | AsyncFunctionDef(identifier name,
19
20
  arguments args,
20
21
  stmt* body,
21
22
  expr* decorator_list,
22
23
  expr? returns,
23
- string? type_comment)
24
+ string? type_comment,
25
+ type_param* type_params)
24
26
 
25
27
  | ClassDef(identifier name,
26
28
  expr* bases,
27
29
  keyword* keywords,
28
30
  stmt* body,
29
- expr* decorator_list)
31
+ expr* decorator_list,
32
+ type_param* type_params)
30
33
  | Return(expr? value)
31
34
 
32
35
  | Delete(expr* targets)
33
36
  | Assign(expr* targets, expr value, string? type_comment)
37
+ | TypeAlias(expr name, type_param* type_params, expr value)
34
38
  | AugAssign(expr target, operator op, expr value)
35
39
  -- 'simple' indicates that we annotate simple name without parens
36
40
  | AnnAssign(expr target, expr annotation, expr? value, int simple)
@@ -182,4 +186,9 @@ module Python version "3.12"
182
186
  attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
183
187
 
184
188
  type_ignore = TypeIgnore(int lineno, string tag)
189
+
190
+ type_param = TypeVar(identifier name, expr? bound)
191
+ | ParamSpec(identifier name)
192
+ | TypeVarTuple(identifier name)
193
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
185
194
  }
@@ -91,8 +91,8 @@ To enable a certain functionality in RestrictedPython, do the following:
91
91
  * icemac
92
92
  * loechel
93
93
 
94
- Differences between different Python versions
95
- ---------------------------------------------
94
+ Differences between Python versions
95
+ -----------------------------------
96
96
 
97
97
  A (modified style) Copy of all Abstract Grammar Definitions for the Python versions does live in this Documentation (ast Subfolder) to help finding difference quicker by comparing files.
98
98
 
@@ -152,14 +152,14 @@ The ``ast`` module consists of four areas:
152
152
  A ``NodeVisitor`` is a class of a node / AST consumer, it reads the data by stepping through the tree without modifying it.
153
153
  In contrast, a ``NodeTransformer`` (which inherits from a ``NodeVisitor``) is allowed to modify the tree and nodes.
154
154
 
155
- Technical decissions on how to implement / maintain RestrictedPython (Design, Structure, Tools, ...)
156
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
155
+ Technical decisions on how to implement / maintain RestrictedPython (Design, Structure, Tools, ...)
156
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
157
157
 
158
158
  RestrictedPython is a core Package of the Zope & Plone Stack.
159
159
  Until Version 3.6 RestrictedPython was Python 2 only, and a critical blocker for Zope & Plone.
160
- With RestrictedPython 4.0 an API compatible rewrite has happend, which supports modern Python Versions.
160
+ With RestrictedPython 4.0 an API compatible rewrite has happened, which supports modern Python Versions.
161
161
 
162
- * Use modern python tool stack for maintainance and tests
162
+ * Use modern python tool stack for maintenance and tests
163
163
 
164
164
  * tox
165
165
  * pytest
@@ -179,7 +179,7 @@ With RestrictedPython 4.0 an API compatible rewrite has happend, which supports
179
179
  Resolve discussion about how RestrictedPython should be treat new expressions / ``ast.Nodes``.
180
180
  This belongs to :ref:`new_python_version`.
181
181
 
182
- **Option 1 - reduce maintainance burden (prefered by icemac)**
182
+ **Option 1 - reduce maintenance burden (preferred by icemac)**
183
183
 
184
184
 
185
185
  All AST Nodes without an explicit ``visit_<AST Node>`` method, are denied by default.
@@ -187,7 +187,7 @@ With RestrictedPython 4.0 an API compatible rewrite has happend, which supports
187
187
 
188
188
  *This is currently the promoted version.*
189
189
 
190
- **Option 2 - be as explicite as possible (prefered by loechel)**
190
+ **Option 2 - be as explicit as possible (preferred by loechel)**
191
191
 
192
192
  If the new AST Node should be disabled by default, add a ``visit_<AST Node>`` method such as the following:
193
193
 
@@ -237,12 +237,12 @@ Technical Backgrounds - Links to External Documentation
237
237
 
238
238
  * AST Grammar of Python (`Status of Python Versions`_)
239
239
 
240
- * `Python 3.12 AST`_ (development branch - EOL 2028-10)
241
- * `Python 3.11 AST`_ (in bugfix phase - EOL 2027-10)
242
- * `Python 3.10 AST`_ (in bugfix phase - EOL 2026-10)
243
- * `Python 3.9 AST`_ (in security phase - EOL 2025-10)
244
- * `Python 3.8 AST`_ (in security phase - EOL 2024-10)
245
- * `Python 3.7 AST`_ (in security phase - EOL 2023-06-27)
240
+ * `Python 3.12 AST`_ (EOL 2028-10)
241
+ * `Python 3.11 AST`_ (EOL 2027-10)
242
+ * `Python 3.10 AST`_ (EOL 2026-10)
243
+ * `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
246
 
247
247
  * `AST NodeVistiors Class`_
248
248
  * `AST NodeTransformer Class`_
@@ -0,0 +1 @@
1
+ Sphinx
@@ -26,11 +26,6 @@ Full code coverage tests.
26
26
 
27
27
  stephan-hof did propose a solution, should be discussed and if approved implemented.
28
28
 
29
- RestrictedPython 4.1+
30
- ---------------------
31
-
32
- Enhance RestrictedPython, declare deprecations and possible new restrictions.
33
-
34
29
  RestrictedPython 6.0+
35
30
  ---------------------
36
31
 
@@ -32,7 +32,7 @@ tests_require = [
32
32
 
33
33
  setup(
34
34
  name='RestrictedPython',
35
- version='7.0a1.dev1',
35
+ version='7.1',
36
36
  url='https://github.com/zopefoundation/RestrictedPython',
37
37
  license='ZPL 2.1',
38
38
  description=(
@@ -52,6 +52,7 @@ setup(
52
52
  'Programming Language :: Python :: 3.9',
53
53
  'Programming Language :: Python :: 3.10',
54
54
  'Programming Language :: Python :: 3.11',
55
+ 'Programming Language :: Python :: 3.12',
55
56
  'Programming Language :: Python :: Implementation :: CPython',
56
57
  'Topic :: Security',
57
58
  ],
@@ -768,8 +768,8 @@ class RestrictingNodeTransformer(ast.NodeTransformer):
768
768
  return self.node_contents_visit(node)
769
769
 
770
770
  def visit_MatMult(self, node):
771
- """Matrix multiplication (`@`) is currently not allowed."""
772
- self.not_allowed(node)
771
+ """Allow multiplication (`@`)."""
772
+ return self.node_contents_visit(node)
773
773
 
774
774
  def visit_BoolOp(self, node):
775
775
  """Allow bool operator without restrictions."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RestrictedPython
3
- Version: 7.0a1.dev1
3
+ Version: 7.1
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
@@ -20,13 +20,18 @@ Classifier: Programming Language :: Python :: 3.8
20
20
  Classifier: Programming Language :: Python :: 3.9
21
21
  Classifier: Programming Language :: Python :: 3.10
22
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
23
24
  Classifier: Programming Language :: Python :: Implementation :: CPython
24
25
  Classifier: Topic :: Security
25
26
  Requires-Python: >=3.7, <3.13
26
27
  Description-Content-Type: text/x-rst
28
+ License-File: LICENSE.txt
27
29
  Provides-Extra: test
30
+ Requires-Dist: pytest; extra == "test"
31
+ Requires-Dist: pytest-mock; extra == "test"
28
32
  Provides-Extra: docs
29
- License-File: LICENSE.txt
33
+ Requires-Dist: Sphinx; extra == "docs"
34
+ Requires-Dist: sphinx_rtd_theme; extra == "docs"
30
35
 
31
36
  .. image:: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml/badge.svg
32
37
  :target: https://github.com/zopefoundation/RestrictedPython/actions/workflows/tests.yml
@@ -119,8 +124,14 @@ the documentation `Contributing page
119
124
  Changes
120
125
  =======
121
126
 
122
- 7.0a1.dev1 (2023-09-06)
123
- -----------------------
127
+ 7.1 (2024-03-14)
128
+ ----------------
129
+
130
+ - Add support for the matmul (``@``) operator.
131
+
132
+
133
+ 7.0 (2023-11-17)
134
+ ----------------
124
135
 
125
136
  Backwards incompatible changes
126
137
  ++++++++++++++++++++++++++++++
@@ -130,8 +141,7 @@ Backwards incompatible changes
130
141
  Features
131
142
  ++++++++
132
143
 
133
- - Allow to use the package with Python 3.12 -- Caution: No security audit has
134
- been done so far.
144
+ - Officially support Python 3.12.
135
145
 
136
146
  Fixes
137
147
  +++++
@@ -141,8 +151,7 @@ Fixes
141
151
  - Forbid using some attributes providing access to restricted Python internals.
142
152
  (CVE-2023-37271)
143
153
 
144
- - Fix information disclosure problems through
145
- Python's "format" functionality
154
+ - Fix information disclosure problems through Python's "format" functionality
146
155
  (``format`` and ``format_map`` methods on ``str`` and its instances,
147
156
  ``string.Formatter``). (CVE-2023-41039)
148
157
 
@@ -1,3 +1,4 @@
1
+ .readthedocs.yaml
1
2
  CHANGES.rst
2
3
  CONTRIBUTING.md
3
4
  COPYRIGHT.txt
@@ -16,6 +17,7 @@ docs/idea.rst
16
17
  docs/index.rst
17
18
  docs/logo.jpg
18
19
  docs/make.bat
20
+ docs/requirements.txt
19
21
  docs/contributing/changes_from310to311.rst
20
22
  docs/contributing/changes_from311to312.rst
21
23
  docs/contributing/changes_from36to37.rst
@@ -1,4 +1,3 @@
1
- from RestrictedPython import compile_restricted_eval
2
1
  from tests.helper import restricted_eval
3
2
 
4
3
 
@@ -33,8 +32,12 @@ def test_FloorDiv():
33
32
 
34
33
 
35
34
  def test_MatMult():
36
- result = compile_restricted_eval('(8, 3, 5) @ (2, 7, 1)')
37
- assert result.errors == (
38
- 'Line None: MatMult statements are not allowed.',
39
- )
40
- assert result.code is None
35
+ class Vector:
36
+ def __init__(self, values):
37
+ self.values = values
38
+
39
+ def __matmul__(self, other):
40
+ return sum(x * y for x, y in zip(self.values, other.values))
41
+
42
+ assert restricted_eval(
43
+ 'Vector((8, 3, 5)) @ Vector((2, 7, 1))', {'Vector': Vector}) == 42
@@ -3,6 +3,7 @@
3
3
  [tox]
4
4
  minversion = 3.18
5
5
  envlist =
6
+ release-check
6
7
  lint
7
8
  py37
8
9
  py38
@@ -10,6 +11,7 @@ envlist =
10
11
  py310
11
12
  py311
12
13
  py312
14
+ py313
13
15
  docs
14
16
  coverage
15
17
  py39-datetime
@@ -17,7 +19,9 @@ envlist =
17
19
 
18
20
  [testenv]
19
21
  usedevelop = true
20
- pip_pre = py312: true
22
+ package = wheel
23
+ wheel_build_env = .pkg
24
+ pip_pre = py313: true
21
25
  deps =
22
26
  datetime: DateTime
23
27
  -cconstraints.txt
@@ -25,6 +29,8 @@ deps =
25
29
  Sphinx
26
30
  setenv =
27
31
  COVERAGE_FILE=.coverage.{envname}
32
+ py312: VIRTUALENV_PIP=23.1.2
33
+ py312: PIP_REQUIRE_VIRTUALENV=0
28
34
  commands =
29
35
  python -V
30
36
  pytest --cov=src --cov=tests --cov-report= {posargs}
@@ -48,22 +54,32 @@ commands =
48
54
  coverage combine
49
55
  coverage html
50
56
  coverage report -m --fail-under=100
51
- depends = py37,py38,py39,py39-datetime,py310,py311,py312coverage
52
-
53
- [testenv:lint]
57
+ depends = py37,py38,py39,py39-datetime,py310,py311,py312,coverage
58
+ [testenv:release-check]
59
+ description = ensure that the distribution is ready to release
54
60
  basepython = python3
55
61
  skip_install = true
62
+ deps =
63
+ twine
64
+ build
65
+ check-manifest
66
+ check-python-versions >= 0.20.0
67
+ wheel
56
68
  commands =
57
- isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py {toxinidir}/tests
58
- flake8 src setup.py tests
59
69
  check-manifest
60
70
  check-python-versions
71
+ python -m build --sdist --no-isolation
72
+ twine check dist/*
73
+
74
+ [testenv:lint]
75
+ basepython = python3
76
+ skip_install = true
61
77
  deps =
62
- check-manifest
63
- check-python-versions >= 0.19.1
64
- wheel
65
- flake8
66
78
  isort
79
+ flake8
80
+ commands =
81
+ isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py {toxinidir}/tests
82
+ flake8 src setup.py tests
67
83
 
68
84
  [testenv:isort-apply]
69
85
  basepython = python3