From 9d30aa3f24045f856f025621f0473c8189cc1522 Mon Sep 17 00:00:00 2001 From: furkanonder Date: Thu, 19 Jan 2023 18:45:09 +0300 Subject: [PATCH 1/7] Add cross-reference to the documentation for faulthandler, traceback, and pdb --- Doc/library/faulthandler.rst | 6 ++++++ Doc/library/pdb.rst | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index 07a7489941442b..eceafa7fa7c361 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -52,6 +52,8 @@ Dumping the traceback Dump the tracebacks of all threads into *file*. If *all_threads* is ``False``, dump only the current thread. + See also :func:`traceback.print_tb` which can be used to print a traceback object. + .. versionchanged:: 3.5 Added support for passing file descriptor to this function. @@ -179,3 +181,7 @@ handler: File "", line 1 in Segmentation fault +.. seealso:: + + Module :mod:`pdb` + Interactive source code debugger for Python programs. diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 383c3adcf289d5..0f2a3950016889 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -545,6 +545,14 @@ can be overridden by the local file. Print the return value for the last return of a function. +.. seealso:: + + Module :mod:`faulthandler` + Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. + + Module :mod:`pdb` + Interactive source code debugger for Python programs. + .. rubric:: Footnotes .. [1] Whether a frame is considered to originate in a certain module From 2d673d910331afdd36dd126b79f0b574b2d3b1f9 Mon Sep 17 00:00:00 2001 From: furkanonder Date: Thu, 19 Jan 2023 22:13:22 +0300 Subject: [PATCH 2/7] add cross-reference to the documentation for faulthandler, traceback, and pdb --- Doc/library/pdb.rst | 6 ++---- Doc/library/traceback.rst | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 0f2a3950016889..47a5974cafc53b 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -548,10 +548,8 @@ can be overridden by the local file. .. seealso:: Module :mod:`faulthandler` - Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. - - Module :mod:`pdb` - Interactive source code debugger for Python programs. + Used to dump Python tracebacks explicitly, on a fault, after a timeout, + or on a user signal. .. rubric:: Footnotes diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index f8c1eabadacf9f..9db01a7c619f09 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -537,3 +537,11 @@ This last example demonstrates the final few formatting functions: >>> an_error = IndexError('tuple index out of range') >>> traceback.format_exception_only(type(an_error), an_error) ['IndexError: tuple index out of range\n'] + +.. seealso:: + + Module :mod:`faulthandler` + Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. + + Module :mod:`pdb` + Interactive source code debugger for Python programs. From 1f73fdae5814cad4ba6679d86b908d89207d9f7c Mon Sep 17 00:00:00 2001 From: furkanonder Date: Thu, 19 Jan 2023 22:19:22 +0300 Subject: [PATCH 3/7] add traceback module into seealso section --- Doc/library/faulthandler.rst | 3 +++ Doc/library/pdb.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index eceafa7fa7c361..999f06904835fe 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -185,3 +185,6 @@ handler: Module :mod:`pdb` Interactive source code debugger for Python programs. + + Module :mod:`traceback` + Standard interface to extract, format and print stack traces of Python programs. diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index 47a5974cafc53b..0c72203bf31833 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -551,6 +551,9 @@ can be overridden by the local file. Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. + Module :mod:`traceback` + Standard interface to extract, format and print stack traces of Python programs. + .. rubric:: Footnotes .. [1] Whether a frame is considered to originate in a certain module From bd4b3ee11abb9845d177ebfeae4e4c1c42746c34 Mon Sep 17 00:00:00 2001 From: Furkan Onder Date: Fri, 20 Jan 2023 11:42:52 +0300 Subject: [PATCH 4/7] Add space the beginning of the sentence. Co-authored-by: C.A.M. Gerlach --- 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 0c72203bf31833..ddcd74cae763dd 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -552,7 +552,7 @@ can be overridden by the local file. or on a user signal. Module :mod:`traceback` - Standard interface to extract, format and print stack traces of Python programs. + Standard interface to extract, format and print stack traces of Python programs. .. rubric:: Footnotes From b8062751a93a6cb79ce01de3fadf9c81217d260f Mon Sep 17 00:00:00 2001 From: Furkan Onder Date: Fri, 20 Jan 2023 11:43:14 +0300 Subject: [PATCH 5/7] Add space the beginning of the sentence Co-authored-by: C.A.M. Gerlach --- Doc/library/faulthandler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index 999f06904835fe..a43c1c0147aca5 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -187,4 +187,4 @@ handler: Interactive source code debugger for Python programs. Module :mod:`traceback` - Standard interface to extract, format and print stack traces of Python programs. + Standard interface to extract, format and print stack traces of Python programs. From 9adac5a12643fe4e285f878671c65520faa31fca Mon Sep 17 00:00:00 2001 From: Furkan Onder Date: Fri, 20 Jan 2023 11:43:30 +0300 Subject: [PATCH 6/7] Add missing comma Co-authored-by: C.A.M. Gerlach --- Doc/library/faulthandler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index a43c1c0147aca5..c47f17fcfe6cd3 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -52,7 +52,7 @@ Dumping the traceback Dump the tracebacks of all threads into *file*. If *all_threads* is ``False``, dump only the current thread. - See also :func:`traceback.print_tb` which can be used to print a traceback object. + .. seealso:: :func:`traceback.print_tb`, which can be used to print a traceback object. .. versionchanged:: 3.5 Added support for passing file descriptor to this function. From 8a37bd510253d3752cf038a2a3d0080fa65fb681 Mon Sep 17 00:00:00 2001 From: furkanonder Date: Mon, 23 Jan 2023 23:26:22 +0300 Subject: [PATCH 7/7] move see-also sections to top of the module --- Doc/library/faulthandler.rst | 15 +++++++-------- Doc/library/pdb.rst | 18 +++++++++--------- Doc/library/traceback.rst | 17 ++++++++--------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst index c47f17fcfe6cd3..f64dfeb5e081c7 100644 --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -43,6 +43,13 @@ Python is deadlocked. The :ref:`Python Development Mode ` calls :func:`faulthandler.enable` at Python startup. +.. seealso:: + + Module :mod:`pdb` + Interactive source code debugger for Python programs. + + Module :mod:`traceback` + Standard interface to extract, format and print stack traces of Python programs. Dumping the traceback --------------------- @@ -180,11 +187,3 @@ handler: File "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at File "", line 1 in Segmentation fault - -.. seealso:: - - Module :mod:`pdb` - Interactive source code debugger for Python programs. - - Module :mod:`traceback` - Standard interface to extract, format and print stack traces of Python programs. diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst index ddcd74cae763dd..4ae12a5d03a78d 100644 --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -27,6 +27,15 @@ The debugger is extensible -- it is actually defined as the class :class:`Pdb`. This is currently undocumented but easily understood by reading the source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`. +.. seealso:: + + Module :mod:`faulthandler` + Used to dump Python tracebacks explicitly, on a fault, after a timeout, + or on a user signal. + + Module :mod:`traceback` + Standard interface to extract, format and print stack traces of Python programs. + The debugger's prompt is ``(Pdb)``. Typical usage to run a program under control of the debugger is:: @@ -545,15 +554,6 @@ can be overridden by the local file. Print the return value for the last return of a function. -.. seealso:: - - Module :mod:`faulthandler` - Used to dump Python tracebacks explicitly, on a fault, after a timeout, - or on a user signal. - - Module :mod:`traceback` - Standard interface to extract, format and print stack traces of Python programs. - .. rubric:: Footnotes .. [1] Whether a frame is considered to originate in a certain module diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 9db01a7c619f09..69818baf184d7c 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -20,8 +20,15 @@ The module uses traceback objects --- this is the object type that is stored in the :data:`sys.last_traceback` variable and returned as the third item from :func:`sys.exc_info`. -The module defines the following functions: +.. seealso:: + + Module :mod:`faulthandler` + Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. + Module :mod:`pdb` + Interactive source code debugger for Python programs. + +The module defines the following functions: .. function:: print_tb(tb, limit=None, file=None) @@ -537,11 +544,3 @@ This last example demonstrates the final few formatting functions: >>> an_error = IndexError('tuple index out of range') >>> traceback.format_exception_only(type(an_error), an_error) ['IndexError: tuple index out of range\n'] - -.. seealso:: - - Module :mod:`faulthandler` - Used to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. - - Module :mod:`pdb` - Interactive source code debugger for Python programs.