Skip to content

A timeout or abort no longer leaves the session quiet or boxing - #2132

Merged
rocky merged 1 commit into
masterfrom
interrupt-restores-state
Nov 12, 2026
Merged

rocky merged 1 commit into
masterfrom
interrupt-restores-state

Conversation

@tombouctou

Copy link
Copy Markdown
Collaborator

A follow-up to #2093. Plot turns messages off (evaluation.quiet_all) while it samples its functions, and formatting sets evaluation.is_boxing. Both were put back only on a normal return. A timeout given to evaluate (or an Abort[]) in the middle of a Plot left the session silent for good:

In[1]:= Plot[(Do[k, {k, 10^4}]; x), {x, 0, 1}]   (* with timeout=0.3 *)
Out[1]= $Aborted                                  (* no "Timeout reached." *)
In[2]:= 1/0
Out[2]= ComplexInfinity                           (* no Power::infy, nor any later message *)

is_boxing stuck at True also turned TraceEvaluation off for the rest of the session.

The state is now restored in finally in:

  • Plot: the per-point function, and the whole of eval_Plot, which is now a thin wrapper around _eval_Plot, so the 170-line body is not reindented;
  • format_element;
  • the TraceEvaluation call hook (is_boxing);
  • print_out, which turns trace_evaluation off while it formats a Print.

Already safe, checked: Block (dynamic_scoping), Quiet, Check, Get, the iteration and recursion counters, evaluation.options.

New test test_evaluate_timeout_restores_state: a timed-out Plot gives $Aborted and "Timeout reached.", and the next 1/0 shows its message. It fails on master.

🤖 Generated with Claude Code

Plot turns messages off (`evaluation.quiet_all`) while it samples its
functions, and formatting sets `evaluation.is_boxing`; both were put
back only on a normal return. A timeout given to `evaluate` (or an
Abort[]) in the middle of a Plot left the session silent for good:
the `General::timeout` of that very evaluation was not shown, and no
later message either (`1/0` gave ComplexInfinity without Power::infy).
`is_boxing` stuck at True also turned TraceEvaluation off.

The state is now restored in `finally` in Plot (both the per-point
function and the whole of eval_Plot), in format_element, in the
TraceEvaluation call hook and in print_out (which turns
trace_evaluation off while formatting a Print).

Block (dynamic_scoping), Quiet, Check, Get, the iteration and recursion
counters already restore their state in `finally`.

MATH-419.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rocky

rocky commented Nov 12, 2026

Copy link
Copy Markdown
Member

LGTM

@rocky
rocky merged commit 6eea917 into master Nov 12, 2026
16 checks passed
@rocky
rocky deleted the interrupt-restores-state branch November 12, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants