RestrictedPython 8.1__py3-none-any.whl → 8.2__py3-none-any.whl
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.
- RestrictedPython/Guards.py +1 -0
- RestrictedPython/_compat.py +0 -1
- RestrictedPython/transformer.py +3 -72
- {restrictedpython-8.1.dist-info → restrictedpython-8.2.dist-info}/METADATA +19 -28
- restrictedpython-8.2.dist-info/RECORD +14 -0
- {restrictedpython-8.1.dist-info → restrictedpython-8.2.dist-info}/WHEEL +1 -1
- restrictedpython-8.1.dist-info/RECORD +0 -14
- {restrictedpython-8.1.dist-info → restrictedpython-8.2.dist-info}/licenses/LICENSE.txt +0 -0
- {restrictedpython-8.1.dist-info → restrictedpython-8.2.dist-info}/top_level.txt +0 -0
RestrictedPython/Guards.py
CHANGED
RestrictedPython/_compat.py
CHANGED
|
@@ -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
|
RestrictedPython/transformer.py
CHANGED
|
@@ -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.
|
|
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
|
|
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,
|
|
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.
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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:
|
|
12
|
-
Keywords: restricted
|
|
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:
|
|
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.
|
|
126
|
+
8.2 (2026-05-29)
|
|
141
127
|
----------------
|
|
142
128
|
|
|
143
|
-
-
|
|
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
|
-
|
|
150
|
-
|
|
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)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
RestrictedPython/Eval.py,sha256=pa79tc-JsT7xfzwg0ceMkxyioIEnFbNHc_PsKUhkkj8,3201
|
|
2
|
+
RestrictedPython/Guards.py,sha256=e8xUs0VbvEQxnUu7ylyJNq7xyhGhQ4QuiiAEJIl4mc4,8105
|
|
3
|
+
RestrictedPython/Limits.py,sha256=dORpuly21vSjy8gzNac9IYfIXMMWRVFvqUiKKIeZ3OM,1866
|
|
4
|
+
RestrictedPython/PrintCollector.py,sha256=bBCpnUPOuKz1wJDuSgh7wo2aoKfcTJeeT8OYnM-K9F8,1137
|
|
5
|
+
RestrictedPython/Utilities.py,sha256=u4HUdyjGawaeHyXSakyt4gRT17BZietXnF5WqicujjE,3033
|
|
6
|
+
RestrictedPython/__init__.py,sha256=qB_s6zDxuXPAGMoKYKBMc-xZ0gTnQ0ZvtY5FxdAG3aM,1862
|
|
7
|
+
RestrictedPython/_compat.py,sha256=eGzz9dyKpYrhyytUV1Ul860zu5GZq9Ew9EQ3CqjVl0Y,385
|
|
8
|
+
RestrictedPython/compile.py,sha256=IhcF733t-bkPcvfQ2_NyBeCbSIPtHYxR-GQNNHnaMHM,6727
|
|
9
|
+
RestrictedPython/transformer.py,sha256=Oggxl6_xDYy2R5hctTr3VosDrjlJhji4bfKpakEb77k,40181
|
|
10
|
+
restrictedpython-8.2.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070
|
|
11
|
+
restrictedpython-8.2.dist-info/METADATA,sha256=lYprml1KS5k2caN47DNcCO3wTo47ttPbdZ8K0OfJgfU,14459
|
|
12
|
+
restrictedpython-8.2.dist-info/WHEEL,sha256=YLJXdYXQ2FQ0Uqn2J-6iEIC-3iOey8lH3xCtvFLkd8Q,91
|
|
13
|
+
restrictedpython-8.2.dist-info/top_level.txt,sha256=E1-3ARWcduVJnQAScms0FgqnBx_PovrzYsNMYuLGwa0,17
|
|
14
|
+
restrictedpython-8.2.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
RestrictedPython/Eval.py,sha256=pa79tc-JsT7xfzwg0ceMkxyioIEnFbNHc_PsKUhkkj8,3201
|
|
2
|
-
RestrictedPython/Guards.py,sha256=hGLMmqB7SPWwaxHl5elPED6MPCLCWg2nmCVM4_OYaV4,8089
|
|
3
|
-
RestrictedPython/Limits.py,sha256=dORpuly21vSjy8gzNac9IYfIXMMWRVFvqUiKKIeZ3OM,1866
|
|
4
|
-
RestrictedPython/PrintCollector.py,sha256=bBCpnUPOuKz1wJDuSgh7wo2aoKfcTJeeT8OYnM-K9F8,1137
|
|
5
|
-
RestrictedPython/Utilities.py,sha256=u4HUdyjGawaeHyXSakyt4gRT17BZietXnF5WqicujjE,3033
|
|
6
|
-
RestrictedPython/__init__.py,sha256=qB_s6zDxuXPAGMoKYKBMc-xZ0gTnQ0ZvtY5FxdAG3aM,1862
|
|
7
|
-
RestrictedPython/_compat.py,sha256=oWDpXfUVHwB36euBXNGs3ctNpbHwKCyNhU1VZAP_U0o,452
|
|
8
|
-
RestrictedPython/compile.py,sha256=IhcF733t-bkPcvfQ2_NyBeCbSIPtHYxR-GQNNHnaMHM,6727
|
|
9
|
-
RestrictedPython/transformer.py,sha256=kpWFVLJ1SjBjDzTJhoNfRvnPOHUBy4X6f_XEbyOs7M0,42376
|
|
10
|
-
restrictedpython-8.1.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070
|
|
11
|
-
restrictedpython-8.1.dist-info/METADATA,sha256=iKqfMV3IMYc-rwgXSn0HYV0JXrC0R7CZo3w2Lv0ES94,14608
|
|
12
|
-
restrictedpython-8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
restrictedpython-8.1.dist-info/top_level.txt,sha256=E1-3ARWcduVJnQAScms0FgqnBx_PovrzYsNMYuLGwa0,17
|
|
14
|
-
restrictedpython-8.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|