Skip to content

Commit b3bb5b0

Browse files
committed
Guard agains None eval returns
1 parent 8fe16a7 commit b3bb5b0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

mathicsscript/termshell.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,15 @@ def print_result(self, result, output_style=""):
285285
# FIXME decide what to do here
286286
return
287287

288-
# FIXME: after Mathics last_eval is fixed,
289-
# we need only the True branch of this code
290-
if hasattr(result, "last_eval"):
291-
last_eval = result.last_eval
292-
eval_type = last_eval.get_head_name()
293-
else:
294-
eval_type = ""
295-
last_eval = result.result
288+
last_eval = result.last_eval
296289

297290
if last_eval is not None:
291+
try:
292+
eval_type = last_eval.get_head_name()
293+
except:
294+
print(sys.exc_info()[1])
295+
return
296+
298297
out_str = str(result.result)
299298
if eval_type == "System`Graph":
300299
out_str = "-Graph-"

0 commit comments

Comments
 (0)