mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 01:19:26 +01:00
safeEval: Get rid of eval().
It should be safe considering the AST sanity checks, but I don't see any point in keeping it.
This commit is contained in:
parent
6f4e3a2dbd
commit
3d1e88cb68
@ -202,12 +202,9 @@ def safeEval(s, namespace=None):
|
||||
else:
|
||||
return False
|
||||
if checkNode(node):
|
||||
if namespace is None:
|
||||
return eval(s, namespace, namespace)
|
||||
else:
|
||||
# Probably equivalent to eval() because checkNode(node) is True,
|
||||
# but it's an extra security.
|
||||
return ast.literal_eval(node)
|
||||
# Probably equivalent to eval() because checkNode(node) is True,
|
||||
# but it's an extra security.
|
||||
return ast.literal_eval(node)
|
||||
else:
|
||||
raise ValueError(format('Unsafe string: %q', s))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user