Commit 720b09f2 authored by Jérome Perrin's avatar Jérome Perrin

patches/Restricted: backport Restricted support for next(i, default)

parent bf230f1f
......@@ -89,6 +89,18 @@ add_builtins(bin=bin, classmethod=classmethod, format=format, object=object,
super=super, type=type)
def guarded_next(iterator, default=_marker):
if default is _marker:
ob = next(iterator)
else:
ob = next(iterator, default)
if not isinstance(iterator, SafeIter):
guard(ob, ob)
return ob
# TODO: https://github.com/zopefoundation/AccessControl/pull/131
safe_builtins.update(next=guarded_next)
_safe_class_attribute_dict = {}
import inspect
def allow_class_attribute(klass, access=1):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment