From 95c6aaf11f9e353093d166ba322aaad535043626 Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sat, 4 Jan 2025 22:28:57 +0800 Subject: [PATCH 1/6] Add missing documentation for FrameSummary --- Doc/library/traceback.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index b0ee3fc56ad735..dbf9f6ed918bb5 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -503,7 +503,7 @@ 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, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=None) Represents a single :ref:`frame ` in the :ref:`traceback ` or stack that is being formatted @@ -528,6 +528,10 @@ in a :ref:`traceback `. The line number of the source code for this frame. + .. attribute:: FrameSummary.end_lineno + + The last line number of the source code for this frame. + .. attribute:: FrameSummary.name Equivalent to accessing :attr:`f.f_code.co_name ` on @@ -539,6 +543,9 @@ in a :ref:`traceback `. trailing whitespace stripped. If the source is not available, it is ``None``. + .. attribute:: FrameSummary.end_colno + The last column number of the source code for this frame. + .. _traceback-example: Examples of Using the Module-Level Functions From 01a17278c1a18e9f64d2906cee975a416746e06a Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sat, 4 Jan 2025 23:01:59 +0800 Subject: [PATCH 2/6] Add missing documentation and reformat --- Doc/library/traceback.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index dbf9f6ed918bb5..87d63c207873b3 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -503,7 +503,7 @@ the module-level functions described above. A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `. -.. class:: FrameSummary(filename, lineno, end_lineno=None, name, lookup_line=True, locals=None, line=None, end_colno=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 @@ -528,10 +528,6 @@ in a :ref:`traceback `. The line number of the source code for this frame. - .. attribute:: FrameSummary.end_lineno - - The last line number of the source code for this frame. - .. attribute:: FrameSummary.name Equivalent to accessing :attr:`f.f_code.co_name ` on @@ -543,7 +539,16 @@ 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. + + .. attribute:: FrameSummary.colno + + The column number of the source code for this frame. + .. attribute:: FrameSummary.end_colno + The last column number of the source code for this frame. .. _traceback-example: From b545299560aa69c110c78f2ba38c2c8b84bca2a6 Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sun, 12 Jan 2025 09:12:38 +0800 Subject: [PATCH 3/6] Modify as reviewer suggested --- Doc/library/traceback.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 87d63c207873b3..09960994323801 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -503,7 +503,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, end_lineno=None, colno=None, end_colno=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 @@ -542,14 +544,17 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.end_lineno The last line number of the source code for this frame. + By default, it is ``None`` and is 1-index base. .. attribute:: FrameSummary.colno The column number of the source code for this frame. + By default, it is ``None`` and is 1-index base. .. attribute:: FrameSummary.end_colno The last column number of the source code for this frame. + By default, it is ``None`` and is 1-index base. .. _traceback-example: From 5bbeb70e98ed0213ab4c975d32629d80fc7f2341 Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sat, 1 Mar 2025 18:48:19 +0800 Subject: [PATCH 4/6] modify document as reviewer suggested --- Doc/library/traceback.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 09960994323801..667670e8312419 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -504,7 +504,7 @@ A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `. .. class:: FrameSummary(filename, lineno, name, *,\ - lookup_line=True, locals=None, \ + lookup_line=True, locals=None,\ line=None, end_lineno=None, colno=None, end_colno=None) Represents a single :ref:`frame ` in the @@ -544,17 +544,17 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.end_lineno The last line number of the source code for this frame. - By default, it is ``None`` and is 1-index base. + By default, it is ``None`` and indexation starts from 1. .. attribute:: FrameSummary.colno The column number of the source code for this frame. - By default, it is ``None`` and is 1-index base. + By default, it is ``None`` and indexation starts from 1. .. attribute:: FrameSummary.end_colno The last column number of the source code for this frame. - By default, it is ``None`` and is 1-index base. + By default, it is ``None`` and indexation starts from 1. .. _traceback-example: From 05139699258d9324b0199a8d27487e4406f13927 Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sat, 1 Mar 2025 19:13:48 +0800 Subject: [PATCH 5/6] modify document as reviewer suggested --- Doc/library/traceback.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 5a6a9890242d6d..5acf14a38d8743 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -549,7 +549,7 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.end_lineno The last line number of the source code for this frame. - By default, it is ``None`` and indexation starts from 1. + By default, it is set to ``lineno`` and indexation starts from 1. .. attribute:: FrameSummary.colno @@ -561,6 +561,7 @@ in a :ref:`traceback `. The last column number of the source code for this frame. By default, it is ``None`` and indexation starts from 1. + .. _traceback-example: Examples of Using the Module-Level Functions From 6592448490e0230e05f06edc5a98d3bce0a4e02b Mon Sep 17 00:00:00 2001 From: Damien-Chen Date: Sat, 1 Mar 2025 19:38:06 +0800 Subject: [PATCH 6/6] Change the starting index of column --- Doc/library/traceback.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 5acf14a38d8743..757fdf601cd0fe 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -554,12 +554,12 @@ in a :ref:`traceback `. .. attribute:: FrameSummary.colno The column number of the source code for this frame. - By default, it is ``None`` and indexation starts from 1. + 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 1. + By default, it is ``None`` and indexation starts from 0. .. _traceback-example: