Skip to content

Commit 9bd2fbd

Browse files
committed
Handle $Abort in interrupt
Fix some problems when going into inspect mode.
1 parent aeb0aaf commit 9bd2fbd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

mathicsscript/format.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from mathics.core.atoms import String
1212
from mathics.core.symbols import Symbol
1313
from mathics.core.systemsymbols import (
14+
SymbolAborted,
1415
SymbolExport,
1516
SymbolExportString,
1617
SymbolFullForm,
@@ -21,6 +22,7 @@
2122
SymbolOutputForm,
2223
SymbolPlot,
2324
SymbolStandardForm,
25+
SymbolStringForm,
2426
SymbolTeXForm,
2527
)
2628
from mathics.session import get_settings_value
@@ -61,7 +63,7 @@
6163

6264
def format_output(obj, expr, format=None):
6365
"""
64-
Handle unformatted output using the *specific* capabilities of mathics-django.
66+
Handle unformatted output using the *specific* capabilities of mathicsscript
6567
6668
evaluation.py format_output() from which this was derived is similar but
6769
it can't make use of a front-ends specific capabilities.
@@ -161,7 +163,13 @@ def eval_boxes(result, fn: Callable, obj, **options):
161163
write_asy_and_view(asy_str)
162164
return expr_type
163165

166+
if expr is SymbolAborted:
167+
return "$Aborted"
164168
if format == "text":
169+
if expr_head is SymbolStringForm:
170+
return expr.elements[0].value
171+
elif isinstance(expr, String):
172+
return expr.value
165173
result = expr.format(obj, SymbolOutputForm)
166174
elif format == "xml":
167175
result = Expression(SymbolStandardForm, expr).format(obj, SymbolMathMLForm)

mathicsscript/interrupt.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def inspect_eval_loop(evaluation: Evaluation):
5353
if result is not None and shell is not None:
5454
shell.print_result(result, prompt=False, strict_wl_output=True)
5555
except TimeoutInterrupt:
56-
print("\nTimeout occurred - ignored.")
5756
pass
5857
except ReturnInterrupt:
5958
evaluation.last_eval = None

0 commit comments

Comments
 (0)