-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Description
In the expr_match function:
def expr_match(ob, ed, c=InstanceDict, r=0):
e, md, push, pop = ed
push(c(ob, md))
try:
r = e.eval(md)
finally:
pop()
return r
The return
in the finally will swallow any in-flight exception. This means that if r.eval(md)
raises any exception (including KeyboardInterrupt
), this exception will be swallowed. This is probably not what the author intended.
See also: https://docs.python.org/3/tutorial/errors.html#defining-clean-up-actions.
It is possible that the intention was to write:
def expr_match(ob, ed, c=InstanceDict, r=0):
e, md, push, pop = ed
push(c(ob, md))
try:
r = e.eval(md)
finally:
pop()
return r
which would return r is there is no exception, but allow the exception to propagate if there is one.
Metadata
Metadata
Assignees
Labels
No labels