Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
Feature or enhancement
Proposal:
Currently, if you set abreakpoint()
in your code, and exit withq
orctrl+D
, the output is just ugly:
Traceback (most recent call last): File "/Users/gaotian/programs/cpython/example.py", line 11, in <module> while True: ^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/bdb.py", line 90, in trace_dispatch return self.dispatch_line(frame) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/lib/python3.12/bdb.py", line 115, in dispatch_line if self.quitting: raise BdbQuit ^^^^^^^^^^^^^bdb.BdbQuit
It makes no sense to print a trackback of an exception just because I want to quit pdb and stop debugging. Now that we have an indicator for inline mode, we can deal with this.
What I propose is - for inline mode debugging, any quit attempt(q
,ctrl+D
, etc.) will trigger a confirm prompt (likegdb
orlldb
), the user can say no and go back to debugging, or they can confirm and quit the program.
There are a few design details which I will list in the following PR.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
- gh-124703: Do not raise an exception when quitting pdb #124704
- gh-124703: Allow the user to choose how to quit pdb in 'inline' mode #129768
- gh-124703: Add documentation and whatsnew entry for pdb exit change #129818
- gh-124703: Add extra checks for pdb quit test #130286
- gh-124703: Change back to raising bdb.BdbQuit when exiting pdb in 'inline' mode in a REPL session #130395
- gh-124703: Set return code to 1 when aborting process from pdb #133013