diff --git a/src/RestrictedPython/Guards.py b/src/RestrictedPython/Guards.py index 245dcb0..af59dcb 100644 --- a/src/RestrictedPython/Guards.py +++ b/src/RestrictedPython/Guards.py @@ -183,10 +183,6 @@ # super # type -# for name in dir(exceptions): -# if name[0] != "_": -# safe_builtins[name] = getattr(exceptions, name) - def _write_wrapper(): # Construct the write wrapper class @@ -267,7 +263,6 @@ def guarded_iter_unpack_sequence(it, spec, _getiter_): For example "for a, b in it" => Each object from the iterator needs guarded sequence unpacking. """ - # The iteration itself needs to be protected as well. for ob in _getiter_(it): yield guarded_unpack_sequence(ob, spec, _getiter_) diff --git a/src/RestrictedPython/Utilities.py b/src/RestrictedPython/Utilities.py index 4bb8f48..aee2b20 100644 --- a/src/RestrictedPython/Utilities.py +++ b/src/RestrictedPython/Utilities.py @@ -16,16 +16,6 @@ import string -# _old_filters = warnings.filters[:] -# warnings.filterwarnings('ignore', category=DeprecationWarning) -# try: -# try: -# import sets -# except ImportError: -# sets = None -# finally: -# warnings.filters[:] = _old_filters - utility_builtins = {} utility_builtins['string'] = string diff --git a/src/RestrictedPython/tests/testRestrictions.py b/src/RestrictedPython/tests/testRestrictions.py index c13e04d..7f3a383 100644 --- a/src/RestrictedPython/tests/testRestrictions.py +++ b/src/RestrictedPython/tests/testRestrictions.py @@ -316,32 +316,6 @@ def test_StackSize(self): 'should have been at least %d, but was only %d' % (k, ss, rss)) - def _test_BeforeAndAfter(self, mod): - from RestrictedPython.RCompile import RModule - from compiler import parse - - defre = re.compile(r'def ([_A-Za-z0-9]+)_(after|before)\(') - - beforel = [name for name in mod.__dict__ - if name.endswith("_before")] - - for name in beforel: - before = getattr(mod, name) - before_src = get_source(before) - before_src = re.sub(defre, r'def \1(', before_src) - rm = RModule(before_src, '') - tree_before = rm._get_tree() - - after = getattr(mod, name[:-6] + 'after') - after_src = get_source(after) - after_src = re.sub(defre, r'def \1(', after_src) - tree_after = parse(after_src) - - self.assertEqual(str(tree_before), str(tree_after)) - - rm.compile() - verify(rm.getCode()) - def _compile_file(self, name): path = os.path.join(_HERE, name) f = open(path, "r")