Skip to content

Commit

Permalink
Merge pull request #53 from zopefoundation/slice_as_safe_builtin
Browse files Browse the repository at this point in the history
Add `slice()` to safe_builtins.
  • Loading branch information
loechel committed May 3, 2017
2 parents 4d1b2a2 + 7eac358 commit 2037b76
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/RestrictedPython/Guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'range',
'repr',
'round',
'slice',
'str',
'tuple',
'zip'
Expand Down Expand Up @@ -180,7 +181,6 @@
# object
# property
# reload
# slice
# staticmethod
# super
# type
Expand Down
1 change: 1 addition & 0 deletions tests/builtins/test_utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from RestrictedPython._compat import IS_PY3

import pytest


Expand Down
11 changes: 11 additions & 0 deletions tests/test_Guards.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from RestrictedPython.Guards import safe_builtins
from tests import e_eval

import pytest


@pytest.mark.parametrize(*e_eval)
def test_Guards__safe_builtins__1(e_eval):
"""It contains `slice()`."""
restricted_globals = dict(__builtins__=safe_builtins)
assert e_eval('slice(1)', restricted_globals) == slice(1)
1 change: 1 addition & 0 deletions tests/transformer/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest


pytestmark = pytest.mark.skipif(
not IS_PY35_OR_GREATER,
reason="async statement was first introduced in Python 3.5")
Expand Down

0 comments on commit 2037b76

Please sign in to comment.