Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Doc/library/pdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,22 @@ can be overridden by the local file.

Delete the specified alias *name*.

.. pdbcommand:: ! statement
.. pdbcommand:: !statement

Execute the (one-line) *statement* in the context of the current stack frame.
The exclamation point can be omitted unless the first word of the statement
resembles a debugger command. To set a global variable, you can prefix the
assignment command with a :keyword:`global` statement on the same line,
e.g.::
resembles a debugger command, e.g.:

.. code-block:: none

(Pdb) !next(some_iterator)
42
(Pdb)

To set a global variable, you can prefix the assignment command with a
:keyword:`global` statement on the same line, e.g.:

.. code-block:: none

(Pdb) global list_options; list_options = ['-l']
(Pdb)
Expand Down
12 changes: 8 additions & 4 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1638,13 +1638,17 @@ def do_help(self, arg):
do_h = do_help

def help_exec(self):
"""(!) statement
"""(!)statement

Execute the (one-line) statement in the context of the current
stack frame. The exclamation point can be omitted unless the
first word of the statement resembles a debugger command. To
assign to a global variable you must always prefix the command
with a 'global' command, e.g.:
first word of the statement resembles a debugger command, e.g.:
(Pdb) !next(some_iterator)
42
(Pdb)

To assign to a global variable you must always prefix the command with
a 'global' command, e.g.:
(Pdb) global list_options; list_options = ['-l']
(Pdb)
"""
Expand Down
16 changes: 10 additions & 6 deletions Lib/pydoc_data/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5277,17 +5277,21 @@
'\n'
' Delete the specified alias *name*.\n'
'\n'
'! statement\n'
'!statement\n'
'\n'
' Execute the (one-line) *statement* in the context of the '
'current\n'
' stack frame. The exclamation point can be omitted unless the '
'first\n'
' word of the statement resembles a debugger command. To set '
'a\n'
' global variable, you can prefix the assignment command with '
'a\n'
' "global" statement on the same line, e.g.:\n'
' word of the statement resembles a debugger command, e.g.:'
'\n'
' (Pdb) !next(some_iterator)\n'
' 42\n'
' (Pdb)\n'
'\n'
' To set a global variable, you can prefix the assignment command '
' with \n'
' a "global" statement on the same line, e.g.:\n'
'\n'
" (Pdb) global list_options; list_options = ['-l']\n"
' (Pdb)\n'
Expand Down