You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Only support restart command in pdb when it's a command line usage #123756
Now when we have a breakpoint() in the source code and enter pdb, we can do restart and raise a Restart exception - which in most cases will just stop the program with an exception. For other rare cases, it might be even worse.
It simply does not make sense to allow a restart command if pdb is not brought up from command line - that exception is only caught in command line usage. So, we should only allow restart in command line usage and do nothing (except for an error) in other cases.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
In that case, do you think we should have an unknown option as the default - just to keep all the old behavior? Or we should be a bit more aggressive, and use inline(or some other word) as default, to keep the default behavior safer for users? In another word, only allow commands like restart when the pdb is invoked with an explicit option.
Besides restart, I'll also work on exit later. Currently when the user exits pdb invoked by an inline breakpoint an error will be raised and it's just weird to show a trackback of an exception when I exit the debugger. I'll make the behavior similar to other debuggers - ask the user whether they want to exit the process, and do a os._exit() to kill everything quietly.
Activity
iritkatriel commentedon Sep 6, 2024
Rather than allow_restart, I'd add an enum for the ways that pdb can be invoked. That could be useful for other things.
gaogaotiantian commentedon Sep 6, 2024
Do you mean an indicator for whether
pdbis invoked through a inline breakpoint or command line?iritkatriel commentedon Sep 6, 2024
Yes
gaogaotiantian commentedon Sep 6, 2024
In that case, do you think we should have an
unknownoption as the default - just to keep all the old behavior? Or we should be a bit more aggressive, and useinline(or some other word) as default, to keep the default behavior safer for users? In another word, only allow commands likerestartwhen the pdb is invoked with an explicit option.Besides
restart, I'll also work onexitlater. Currently when the user exits pdb invoked by an inline breakpoint an error will be raised and it's just weird to show a trackback of an exception when I exit the debugger. I'll make the behavior similar to other debuggers - ask the user whether they want to exit the process, and do aos._exit()to kill everything quietly.iritkatriel commentedon Sep 6, 2024
It can be None by default, and for each situation make None behave like it used to.
gh-123756: Disable restart command if pdb is in inline mode (#123757)