From 1f232addb88b86d76848a16fcfc69f89a6aac6ce Mon Sep 17 00:00:00 2001 From: Damien <81557462+Damien-Chen@users.noreply.github.com> Date: Sun, 2 Mar 2025 17:29:12 +0800 Subject: [PATCH 1/3] gh-128481: Improve documentation for `traceback.FrameSummary` (GH-128484) Complete the `traceback.FrameSummary` signature and add missing documentation for the `colno` and `end_{col,line}no` attributes. (cherry picked from commit 051f0e5683fec3840fa7fc99723741dd2d701eae) Co-authored-by: Damien <81557462+Damien-Chen@users.noreply.github.com> --- Doc/library/traceback.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 3beeb49755b533..ebd691a363959a 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -499,7 +499,9 @@ the module-level functions described above. A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `. -.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None) +.. class:: FrameSummary(filename, lineno, name, *,\ + lookup_line=True, locals=None,\ + line=None, end_lineno=None, colno=None, end_colno=None) Represents a single :ref:`frame ` in the :ref:`traceback ` or stack that is being formatted @@ -535,6 +537,22 @@ in a :ref:`traceback `. trailing whitespace stripped. If the source is not available, it is ``None``. + .. attribute:: FrameSummary.end_lineno + + The last line number of the source code for this frame. + By default, it is set to ``lineno`` and indexation starts from 1. + + .. attribute:: FrameSummary.colno + + The column number of the source code for this frame. + By default, it is ``None`` and indexation starts from 0. + + .. attribute:: FrameSummary.end_colno + + The last column number of the source code for this frame. + By default, it is ``None`` and indexation starts from 0. + + .. _traceback-example: Examples of Using the Module-Level Functions From 522b408cdfa7be8e64c6bb75ce8ef3270860cd4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 2 Mar 2025 10:41:43 +0100 Subject: [PATCH 2/3] Update Doc/library/traceback.rst --- Doc/library/traceback.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index ebd691a363959a..2a01b440737049 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -540,7 +540,7 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.end_lineno The last line number of the source code for this frame. - By default, it is set to ``lineno`` and indexation starts from 1. + By default, it is set to ``None`` and indexation starts from 1. .. attribute:: FrameSummary.colno From 0b5b9e38e10124589d1e288f2ec684237113f4b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 2 Mar 2025 10:42:22 +0100 Subject: [PATCH 3/3] revert --- Doc/library/traceback.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 2a01b440737049..ebd691a363959a 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -540,7 +540,7 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.end_lineno The last line number of the source code for this frame. - By default, it is set to ``None`` and indexation starts from 1. + By default, it is set to ``lineno`` and indexation starts from 1. .. attribute:: FrameSummary.colno