Skip to content

Commit

Permalink
Merge branch 'master' into operator-info-from-JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera authored Nov 26, 2024
2 parents 227cb4d + 405b4df commit 3354f75
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mathics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license."""


# Disabled breakpoint
def disabled_breakpoint():
print("Hit disabled breakpoint.")
26 changes: 26 additions & 0 deletions mathics/builtin/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,3 +871,29 @@ def eval_with_symbol(self, symbol, evaluation: Evaluation) -> Integer:
else:
gc.collect()
return Integer0


class Breakpoint(Builtin):
"""
## <url>:trace native symbol:</url>
<dl>
<dt>'Breakpoint[]'
<dd> Invoke a Python breakpoint. By default, the Python debugger \
(pdb) is loaded. For loading other debuggers, the Python environment \
variable `PYTHONBREAKPOINT` can be utilized.
</dl>
>> (* Test with a disabled breakpoint. *)
>> SetEnvironment["PYTHONBREAKPOINT" -> "mathics.disabled_breakpoint"];
>> Breakpoint[]
= Hit disabled breakpoint.
= Breakpoint[]
"""

summary_text = "invoke a Python breakpoint()"

def eval(self, evaluation: Evaluation):
"Breakpoint[]"

breakpoint()

0 comments on commit 3354f75

Please sign in to comment.