Skip to content

Commit

Permalink
fix NameError handling in expression code
Browse files Browse the repository at this point in the history
  • Loading branch information
shazarivf committed Jul 25, 2024
1 parent c673c8b commit cab435a
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 cab435a

Please sign in to comment.