Skip to content

Commit

Permalink
ipdb: accept header= argument
Browse files Browse the repository at this point in the history
This improves symmetry between Ipdb and vanilla old Pdb.

The `header` argument to `pdb.set_trace()` has been added in Python 3.7.
  • Loading branch information
MrMino committed Jan 11, 2024
1 parent 001109a commit 16f84c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions IPython/core/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,13 @@ def _cmdloop(self):
raise


def set_trace(frame=None):
def set_trace(frame=None, header=None):
"""
Start debugging from `frame`.
If frame is not specified, debugging starts from caller's frame.
"""
Pdb().set_trace(frame or sys._getframe().f_back)
pdb = Pdb()
if header is not None:
pdb.message(header)
pdb.set_trace(frame or sys._getframe().f_back)

0 comments on commit 16f84c6

Please sign in to comment.