From e75d604211f26d3fd956e319786aeef1f34254e1 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 15:10:02 -0400 Subject: [PATCH 1/7] Drop misleading space --- Doc/library/pdb.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 74bffef5562ae1..74c6e5946541b3 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -598,7 +598,7 @@ 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 From 1a427c57d9e5f66793a6807dae69a3d43db8365f Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 15:10:24 -0400 Subject: [PATCH 2/7] Add example of exclamation mark prefix for disambiguation --- Doc/library/pdb.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 74c6e5946541b3..2a0e239240fab9 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -602,9 +602,14 @@ can be overridden by the local file. 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.:: + + (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.:: (Pdb) global list_options; list_options = ['-l'] (Pdb) From a0124a299b56085ef47df44850f4bd5654380bc7 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 15:57:21 -0400 Subject: [PATCH 3/7] Use explicit code-block directives to disable syntax highlighting --- Doc/library/pdb.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 2a0e239240fab9..54b66818b75a6f 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -602,14 +602,18 @@ can be overridden by the local file. 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, 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.:: + :keyword:`global` statement on the same line, e.g.: + +.. code-block:: none (Pdb) global list_options; list_options = ['-l'] (Pdb) From 38a1c75e5449937959196c97dc5055ee9a5cdb0e Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 15:57:48 -0400 Subject: [PATCH 4/7] Update duplicate copies of pdb documentation with new prefix explanation --- Lib/pdb.py | 12 ++++++++---- Lib/pydoc_data/topics.py | 18 +++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Lib/pdb.py b/Lib/pdb.py index b3dc5a455e56b9..14b2a7bbf22fbf 100755 --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -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) """ diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 1babb5ce9476c9..0cef0cb1fb8cc9 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -5277,19 +5277,23 @@ '\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) global list_options; list_options = ['-l']\n' ' (Pdb)\n' '\n' 'run [args ...]\n' From ede5a5e14f8fc5f4435763a040edc394ae3a9f52 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 16:08:54 -0400 Subject: [PATCH 5/7] Restore load-bearing double-quotes (oops) --- Lib/pydoc_data/topics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 0cef0cb1fb8cc9..5690e85f0c63ef 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -5293,7 +5293,7 @@ 'with \n' 'a "global" statement on the same line, e.g.:\n' '\n' - ' (Pdb) global list_options; list_options = ['-l']\n' + " (Pdb) global list_options; list_options = ['-l']\n" ' (Pdb)\n' '\n' 'run [args ...]\n' From 69a5a59f2bfd816b1c5c8e9b58d038e000661da8 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 16:15:42 -0400 Subject: [PATCH 6/7] Correctly indent nested code-block directive --- Doc/library/pdb.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 54b66818b75a6f..7fd3dfce7b1660 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -604,7 +604,7 @@ can be overridden by the local file. The exclamation point can be omitted unless the first word of the statement resembles a debugger command, e.g.: -.. code-block:: none + .. code-block:: none (Pdb) !next(some_iterator) 42 @@ -613,7 +613,7 @@ can be overridden by the local file. 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 + .. code-block:: none (Pdb) global list_options; list_options = ['-l'] (Pdb) From 7bf224e201554767cbe585fdc7cd84ae7b697203 Mon Sep 17 00:00:00 2001 From: James Gerity Date: Mon, 8 May 2023 17:48:14 -0400 Subject: [PATCH 7/7] Fix indentation in pydoc_data/topics --- Lib/pydoc_data/topics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 5690e85f0c63ef..baa9fa1c3c940c 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -5289,9 +5289,9 @@ ' 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' + ' 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'