Skip to content

Commit

Permalink
Merge pull request #130 from shazarivf/fix-nameerror-handling
Browse files Browse the repository at this point in the history
fix NameError handling in expression code
  • Loading branch information
newville authored Jul 27, 2024
2 parents c673c8b + cab435a commit 1dec732
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asteval/asteval.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
MINIMAL_CONFIG[_tnode] = False
DEFAULT_CONFIG[_tnode] = True


class Interpreter:
"""create an asteval Interpreter: a restricted, simplified interpreter
of mathematical expressions using Python syntax.
Expand Down Expand Up @@ -295,9 +296,8 @@ def run(self, node, expr=None, lineno=None, with_raise=True):
return ret
except:
if with_raise:
if len(self.error) == 0:
# Unhandled exception that didn't use raise_exception
self.raise_exception(node, expr=expr)
# Unhandled exception that didn't use raise_exception
self.raise_exception(node, expr=expr)
raise
return None

Expand Down

0 comments on commit 1dec732

Please sign in to comment.