Skip to content

Commit

Permalink
We need to have _iter_unpack_sequence_ always in the globals.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed May 4, 2017
1 parent ca59a6a commit 9c61118
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/AccessControl/ZopeGuards.py
Expand Up @@ -23,6 +23,7 @@
import RestrictedPython
from RestrictedPython.Eval import RestrictionCapableEval
from RestrictedPython.Guards import full_write_guard
from RestrictedPython.Guards import guarded_iter_unpack_sequence
from RestrictedPython.Guards import safe_builtins
from RestrictedPython.Utilities import utility_builtins
from zExceptions import Unauthorized
Expand Down Expand Up @@ -652,6 +653,7 @@ def protected_inplacevar(op, var, expr):
'_apply_': guarded_apply,
'_getitem_': guarded_getitem,
'_getiter_': guarded_iter,
'_iter_unpack_sequence_': guarded_iter_unpack_sequence,
'_print_': RestrictedPython.PrintCollector,
'_write_': full_write_guard,
'_inplacevar_': protected_inplacevar,
Expand Down
2 changes: 0 additions & 2 deletions src/AccessControl/tests/testZopeGuards.py
Expand Up @@ -904,13 +904,11 @@ def test_guarded_next__3(self):
def _compile_str(self, text, name):
from RestrictedPython import compile_restricted
from AccessControl.ZopeGuards import get_safe_globals, guarded_getattr
from RestrictedPython.Guards import guarded_iter_unpack_sequence

code = compile_restricted(text, name, 'exec')

g = get_safe_globals()
g['_getattr_'] = guarded_getattr
g['_iter_unpack_sequence_'] = guarded_iter_unpack_sequence
g['__debug__'] = 1 # so assert statements are active
g['__name__'] = __name__ # so classes can be defined in the script
return code, g
Expand Down

0 comments on commit 9c61118

Please sign in to comment.