diff options
Diffstat (limited to 'lib/kross/python/scripts/RestrictedPython/Limits.py')
-rw-r--r-- | lib/kross/python/scripts/RestrictedPython/Limits.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/kross/python/scripts/RestrictedPython/Limits.py b/lib/kross/python/scripts/RestrictedPython/Limits.py index 3b782e65..4e4511f1 100644 --- a/lib/kross/python/scripts/RestrictedPython/Limits.py +++ b/lib/kross/python/scripts/RestrictedPython/Limits.py @@ -25,22 +25,22 @@ def limited_range(iFirst, *args): elif len(args) == 2: iStart, iEnd, iStep = iFirst, args[0], args[1] else: - raise AttributeError, 'range() requires 1-3 int arguments' - if iStep == 0: raise ValueError, 'zero step for range()' + raise AttributeError('range() requires 1-3 int arguments') + if iStep == 0: raise ValueError('zero step for range()') iLen = int((iEnd - iStart) / iStep) if iLen < 0: iLen = 0 - if iLen >= RANGELIMIT: raise ValueError, 'range() too large' - return range(iStart, iEnd, iStep) + if iLen >= RANGELIMIT: raise ValueError('range() too large') + return list(range(iStart, iEnd, iStep)) limited_builtins['range'] = limited_range def limited_list(seq): if isinstance(seq, str): - raise TypeError, 'cannot convert string to list' + raise TypeError('cannot convert string to list') return list(seq) limited_builtins['list'] = limited_list def limited_tuple(seq): if isinstance(seq, str): - raise TypeError, 'cannot convert string to tuple' + raise TypeError('cannot convert string to tuple') return tuple(seq) limited_builtins['tuple'] = limited_tuple |