@@ -159,12 +159,15 @@ slightly different way:
159159   is entered.
160160
161161
162- .. function :: set_trace(*, header=None) 
162+ .. function :: set_trace(*, header=None, commands=None ) 
163163
164164   Enter the debugger at the calling stack frame.  This is useful to hard-code
165165   a breakpoint at a given point in a program, even if the code is not
166166   otherwise being debugged (e.g. when an assertion fails).  If given,
167167   *header * is printed to the console just before debugging begins.
168+    The *commands * argument, if given, is a list of commands to execute
169+    when the debugger starts.
170+ 
168171
169172   .. versionchanged :: 3.7 
170173      The keyword-only argument *header *.
@@ -173,6 +176,9 @@ slightly different way:
173176      :func: `set_trace ` will enter the debugger immediately, rather than
174177      on the next line of code to be executed.
175178
179+    .. versionadded :: 3.14 
180+       The *commands * argument.
181+ 
176182.. function :: post_mortem(traceback=None) 
177183
178184   Enter post-mortem debugging of the given *traceback * object.  If no
@@ -192,7 +198,7 @@ The ``run*`` functions and :func:`set_trace` are aliases for instantiating the
192198access further features, you have to do this yourself:
193199
194200.. class :: Pdb(completekey='tab', stdin=None, stdout=None, skip=None, \ 
195-                nosigint=False, readrc=True)
201+                nosigint=False, readrc=True, mode=None )
196202
197203   :class: `Pdb ` is the debugger class.
198204
@@ -211,6 +217,13 @@ access further features, you have to do this yourself:
211217   The *readrc * argument defaults to true and controls whether Pdb will load
212218   .pdbrc files from the filesystem.
213219
220+    The *mode * argument specifies how the debugger was invoked.
221+    It impacts the workings of some debugger commands.
222+    Valid values are ``'inline' `` (used by the breakpoint() builtin),
223+    ``'cli' `` (used by the command line invocation)
224+    or ``None `` (for backwards compatible behaviour, as before the *mode *
225+    argument was added).
226+ 
214227   Example call to enable tracing with *skip *::
215228
216229      import pdb; pdb.Pdb(skip=['django.*']).set_trace() 
@@ -227,6 +240,9 @@ access further features, you have to do this yourself:
227240   .. versionchanged :: 3.6 
228241      The *readrc * argument.
229242
243+    .. versionadded :: 3.14 
244+       Added the *mode * argument.
245+ 
230246   .. method :: run(statement, globals=None, locals=None) 
231247               runeval(expression, globals=None, locals=None)
232248               runcall(function, *args, **kwds) 
@@ -669,6 +685,10 @@ can be overridden by the local file.
669685   History, breakpoints, actions and debugger options are preserved.
670686   :pdbcmd: `restart ` is an alias for :pdbcmd: `run `.
671687
688+    .. versionchanged :: 3.14 
689+       :pdbcmd: `run ` and :pdbcmd: `restart ` commands are disabled when the
690+       debugger is invoked in ``'inline' `` mode.
691+ 
672692.. pdbcommand :: q(uit) 
673693
674694   Quit from the debugger.  The program being executed is aborted.
0 commit comments