Commit 4e9c0da2 authored by Aurel's avatar Aurel

update for SafeIter next

parent f9c89ebf
......@@ -106,8 +106,10 @@ def guarded_next(iterator, default=_marker):
if default is _marker:
raise
return default
BBB_ACCESS_CONTROL = False
if "next" not in safe_builtins: # BBB
add_builtins(next=guarded_next)
BBB_ACCESS_CONTROL = True
_safe_class_attribute_dict = {}
import inspect
......@@ -164,8 +166,8 @@ class TypeAccessChecker:
ContainerAssertions[type] = TypeAccessChecker()
class SafeIterItems(SafeIter):
if BBB_ACCESS_CONTROL:
class SafeIterItems(SafeIter):
def next(self):
ob = self._next()
......@@ -173,6 +175,15 @@ class SafeIterItems(SafeIter):
guard(c, ob[0])
guard(c, ob[1])
return ob
else:
class SafeIterItems(SafeIter):
def next(self):
ob = next(self._iter)
c = self.container
guard(c, ob[0])
guard(c, ob[1])
return ob
def get_iteritems(c, name):
return lambda: SafeIterItems(c.iteritems(), c)
......
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