Skip to content

Commit

Permalink
Merge branch 'master' into issue_181
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jul 10, 2020
2 parents adb0aab + f1f1bdb commit 16af4da
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docs/CHANGES.rst
Expand Up @@ -7,6 +7,9 @@ Changes
- Fix ``compile_restricted_function`` with SyntaxErrors that have no text
(`#181 <https://github.com/zopefoundation/RestrictedPython/issues/181>`_)

- Add support for the ``bytes`` and ``sorted`` builtins
(`#186 <https://github.com/zopefoundation/RestrictedPython/issues/186>`_)

- Drop install dependency on ``setuptools``.
(`#189 <https://github.com/zopefoundation/RestrictedPython/issues/189>`_)

Expand Down
3 changes: 2 additions & 1 deletion src/RestrictedPython/Guards.py
Expand Up @@ -33,6 +33,7 @@
'True',
'abs',
'bool',
'bytes',
'callable',
'chr',
'complex',
Expand All @@ -52,6 +53,7 @@
'repr',
'round',
'slice',
'sorted',
'str',
'tuple',
'zip'
Expand Down Expand Up @@ -174,7 +176,6 @@
# one should care.

# buffer
# bytes
# bytearray
# classmethod
# coerce
Expand Down
10 changes: 10 additions & 0 deletions tests/test_Guards.py
Expand Up @@ -15,6 +15,16 @@ def _write_(x):
return x


def test_Guards_bytes():
"""It contains bytes"""
assert restricted_eval('bytes(1)') == bytes(1)


def test_Guards_sorted():
"""It contains sorted"""
assert restricted_eval('sorted([5, 2, 8, 1])') == sorted([5, 2, 8, 1])


def test_Guards__safe_builtins__1():
"""It contains `slice()`."""
assert restricted_eval('slice(1)') == slice(1)
Expand Down

0 comments on commit 16af4da

Please sign in to comment.