simpleeval icon indicating copy to clipboard operation
simpleeval copied to clipboard

Raise error when multi line expression is passed for evaluation

Open PPakalns opened this issue 5 years ago • 1 comments

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.

PPakalns avatar Jul 09 '19 07:07 PPakalns

That's a good idea!

danthedeckie avatar Aug 22 '19 13:08 danthedeckie