gh-123756: Disable restart command if pdb is in inline mode (#123757)

This commit is contained in:
Tian Gao 2024-09-25 11:18:01 -07:00 committed by GitHub
parent da5855e99a
commit 28efeefab7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 4 deletions

View file

@ -198,7 +198,7 @@ The ``run*`` functions and :func:`set_trace` are aliases for instantiating the
access further features, you have to do this yourself:
.. class:: Pdb(completekey='tab', stdin=None, stdout=None, skip=None, \
nosigint=False, readrc=True)
nosigint=False, readrc=True, mode=None)
:class:`Pdb` is the debugger class.
@ -217,6 +217,13 @@ access further features, you have to do this yourself:
The *readrc* argument defaults to true and controls whether Pdb will load
.pdbrc files from the filesystem.
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).
Example call to enable tracing with *skip*::
import pdb; pdb.Pdb(skip=['django.*']).set_trace()
@ -233,6 +240,9 @@ access further features, you have to do this yourself:
.. versionchanged:: 3.6
The *readrc* argument.
.. versionadded:: 3.14
Added the *mode* argument.
.. method:: run(statement, globals=None, locals=None)
runeval(expression, globals=None, locals=None)
runcall(function, *args, **kwds)
@ -675,6 +685,10 @@ can be overridden by the local file.
History, breakpoints, actions and debugger options are preserved.
:pdbcmd:`restart` is an alias for :pdbcmd:`run`.
.. versionchanged:: 3.14
:pdbcmd:`run` and :pdbcmd:`restart` commands are disabled when the
debugger is invoked in ``'inline'`` mode.
.. pdbcommand:: q(uit)
Quit from the debugger. The program being executed is aborted.