Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPDB: "context" command #12826

Merged
merged 2 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions IPython/core/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,20 @@ def do_down(self, arg):
do_d = do_down
do_u = do_up

def do_context(self, context):
"""context number_of_lines
Set the number of lines of source code to show when displaying
stacktrace information.
"""
try:
new_context = int(context)
if new_context <= 0:
raise ValueError()
except ValueError:
self.error("The 'context' command requires a positive integer argument.")
self.context = new_context


class InterruptiblePdb(Pdb):
"""Version of debugger where KeyboardInterrupt exits the debugger altogether."""

Expand Down
5 changes: 5 additions & 0 deletions docs/source/whatsnew/pr/ipdb-context-command.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New "context" command in ipdb
-----------------------------

It is now possible to change the number of lines shown in the backtrace
information in ipdb using "context" command.