From 86480e58eafc1fa3486e03155ed34e02b4595a24 Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Sun, 22 Jan 2023 02:02:13 +0100 Subject: Drop python2 support in scripts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- lib/kross/python/scripts/RestrictedPython/Limits.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/kross/python/scripts/RestrictedPython/Limits.py') diff --git a/lib/kross/python/scripts/RestrictedPython/Limits.py b/lib/kross/python/scripts/RestrictedPython/Limits.py index 3b782e658..4e4511f1e 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 -- cgit v1.2.3