Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

how to disable Python pdb's Quitting pdb will kill the process. Quit anyway [y/n]? prompt

+8
−0

I'm running Python 3.14 in Linux. I have script with a breakpoint() in it, so when I run $ python my_script.py, it will take me into the (Pdb) prompt. Then, if I want to exit, I type q or do CTRL+D. It then shows this prompt:

Quitting pdb will kill the process. Quit anyway [y/n]?

Is there any way to disable this warning? Meaning I want to automatically do the "y" option and kill the process when I type q or do CTRL+D.

History

0 comment threads

1 answer

+4
−0

This behaviour is new in Python 3.14. It is defined in the pdb.Pdb.do_quit method, with the following comment:

Show prompt to kill process when in 'inline' mode and if pdb was not started from an interactive console. The attribute sys.ps1 is only defined if the interpreter is in interactive mode.

If neither of these conditions is met, pdb delegates to the bdb.Bdb.set_quit method, which does not contain a prompt. The Python documentation says:

The mode argument specifies how the debugger was invoked. It impacts the workings of some debugger commands. Valid values are 'inline' (used by the breakpoint() builtin), 'cli' (used by the command line invocation) or None (for backwards compatible behaviour, as before the mode argument was added).

So, one solution would be overriding breakpoint() so that it invokes pdb.Pdb with mode=None, restoring the pre-3.14 quit behaviour. However, I'm not sure how to properly do that. As a hack, inserting sys.ps1 = '>>> ' at some point before your breakpoint() invocation should also work.

History

0 comment threads

Sign up to answer this question »