simpleeval
simpleeval copied to clipboard
Raise error when multi line expression is passed for evaluation
Using simple_eval
method expression like True\nFalse
is evaluated to True, False\nTrue
to False.
It looks like only the first statement is taken from AST for evaluation. https://github.com/danthedeckie/simpleeval/blob/b47858d7153a05f64da16c4425c38f481e510d12/simpleeval.py#L328
I suggest that an exception must be raised in case where there are multiple statements to be sure that passed expression is evaluated correctly.
That's a good idea!