Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise error when multi line expression is passed for evaluation #58

Open
PPakalns opened this issue Jul 9, 2019 · 1 comment · May be fixed by #70
Open

Raise error when multi line expression is passed for evaluation #58

PPakalns opened this issue Jul 9, 2019 · 1 comment · May be fixed by #70
Assignees

Comments

@PPakalns
Copy link

PPakalns commented Jul 9, 2019

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.

return self._eval(ast.parse(expr.strip()).body[0].value)

I suggest that an exception must be raised in case where there are multiple statements to be sure that passed expression is evaluated correctly.

@danthedeckie
Copy link
Owner

That's a good idea!

@danthedeckie danthedeckie self-assigned this Aug 22, 2019
@PPakalns PPakalns linked a pull request Dec 12, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants