Py 3 handles exception propagation a little differently?

This commit is contained in:
Simon Forman 2021-12-23 19:09:07 -08:00
parent 2cc0ea0548
commit c6b46e5f01
1 changed files with 3 additions and 4 deletions

View File

@ -61,11 +61,10 @@ def joy(stack, expression, dictionary, viewer=None):
term, expression = expression
if isinstance(term, Symbol):
try:
term = dictionary[term]
except KeyError:
if term not in dictionary:
raise UnknownSymbolError(term)
stack, expression, dictionary = term(stack, expression, dictionary)
func = dictionary[term]
stack, expression, dictionary = func(stack, expression, dictionary)
else:
stack = term, stack