Skip to content

Commit 4f48bdd

Browse files
committed
Add "debugger" to interrupt handler
Also, follow GPL standards more completely
1 parent d85018c commit 4f48bdd

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

mathicsscript/__main__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#!/usr/bin/env python3
22
# Copyright (C) 2025 Rocky Bernstein <[email protected]>
3-
# -*- coding: utf-8 -*-
3+
# This program is free software: you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation, either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
415

516
import os
617
import os.path as osp

mathicsscript/completion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright (C) 2021-2022, 2024 Rocky Bernstein <[email protected]>
3+
# Copyright (C) 2021-2022, 2024-2025 Rocky Bernstein <[email protected]>
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
66
# the Free Software Foundation, either version 3 of the License, or
@@ -67,6 +67,7 @@ class InterruptCompleter(Completer):
6767
COMMANDS = [
6868
"abort",
6969
"continue",
70+
"debugger",
7071
"exit",
7172
"inspect",
7273
"show",

mathicsscript/interrupt.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright (C) 2025 Rocky Bernstein <[email protected]>
2+
# This program is free software: you can redistribute it and/or modify
3+
# it under the terms of the GNU General Public License as published by
4+
# the Free Software Foundation, either version 3 of the License, or
5+
# (at your option) any later version.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
114
"""
215
mathicsscript Interrupt routines.
316
@@ -108,6 +121,8 @@ def Mathics3_interrupt_handler(
108121
elif user_input in ("continue", "c"):
109122
print_fn("continuing")
110123
break
124+
elif user_input in ("debugger", "d"):
125+
breakpoint()
111126
elif user_input in ("exit", "quit"):
112127
print_fn("Mathics3 exited because of an interrupt.")
113128
sys.exit(3)
@@ -138,6 +153,7 @@ def Mathics3_interrupt_handler(
138153
"""Your options are:
139154
abort (or a) to abort current calculation
140155
continue (or c) to continue
156+
debugger (or d) to to enter a Python debugger
141157
exit (or quit) to exit Mathics3
142158
inspect (or i) to enter an interactive dialog
143159
show (or s) to show current operation (and then continue)

mathicsscript/termshell_gnu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def complete_interrupt_command(self, text, state):
120120
# Only complete from this fixed set
121121
completions = [
122122
w
123-
for w in ["abort", "continue", "exit", "inspect", "show"]
123+
for w in ["abort", "continue", "debugger", "exit", "inspect", "show"]
124124
if w.startswith(text)
125125
]
126126
try:

0 commit comments

Comments
 (0)