From c65b07debb024771e38cc45b68f9363f4f8d6f63 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Thu, 10 Sep 2009 02:48:00 +0300 Subject: [PATCH] safe_eval: make python 2.5 compatible. bzr revid: p_christ@hol.gr-20090909234800-3u0a2fyi6673js4z --- bin/tools/safe_eval.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/tools/safe_eval.py b/bin/tools/safe_eval.py index 6f0a9b88fde..7c4da78375c 100644 --- a/bin/tools/safe_eval.py +++ b/bin/tools/safe_eval.py @@ -26,19 +26,22 @@ ############################################################################### __export_bis = {} +import sys def __init_ebis(): global __export_bis - _evars = [ 'abs', 'all', 'any', 'basestring' , 'bin', 'bool', + _evars = [ 'abs', 'all', 'any', 'basestring' , 'bool', 'chr', 'cmp','complex', 'dict', 'divmod', 'enumerate', - 'float','format', 'frozenset', 'getattr', 'hasattr', 'hash', + 'float', 'frozenset', 'getattr', 'hasattr', 'hash', 'hex', 'id','int', 'iter', 'len', 'list', 'long', 'map', 'max', - 'min','next', 'oct', 'ord','pow', 'range', 'reduce', 'repr', + 'min', 'oct', 'ord','pow', 'range', 'reduce', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice','sorted', 'str', 'sum', 'tuple','type', 'unichr','unicode', 'xrange', 'True','False', 'None', 'NotImplemented', 'Ellipsis', ] + if sys.version_info[0:2] >= (2,6): + _evars.extend(['bin', 'format', 'next']) for v in _evars: __export_bis[v] = __builtins__[v]