Skip to content

Commit

Permalink
Merge branch 'Python3_update' into port_unicode_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Mar 27, 2017
2 parents f39a09b + e0961a8 commit 8846299
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 41 deletions.
5 changes: 0 additions & 5 deletions src/RestrictedPython/Guards.py
Expand Up @@ -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
Expand Down Expand Up @@ -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_)
Expand Down
10 changes: 0 additions & 10 deletions src/RestrictedPython/Utilities.py
Expand Up @@ -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
Expand Down
26 changes: 0 additions & 26 deletions src/RestrictedPython/tests/testRestrictions.py
Expand Up @@ -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")
Expand Down

0 comments on commit 8846299

Please sign in to comment.