Skip to content

Commit 1f232ad

Browse files
Damien-Chenmiss-islington
authored andcommittedMar 2, 2025·
pythongh-128481: Improve documentation for traceback.FrameSummary (pythonGH-128484)
Complete the `traceback.FrameSummary` signature and add missing documentation for the `colno` and `end_{col,line}no` attributes. (cherry picked from commit 051f0e5) Co-authored-by: Damien <81557462+Damien-Chen@users.noreply.github.com>
1 parent 8edf17f commit 1f232ad

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
 

‎Doc/library/traceback.rst

+19-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ the module-level functions described above.
499499
A :class:`!FrameSummary` object represents a single :ref:`frame <frame-objects>`
500500
in a :ref:`traceback <traceback-objects>`.
501501

502-
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None)
502+
.. class:: FrameSummary(filename, lineno, name, *,\
503+
lookup_line=True, locals=None,\
504+
line=None, end_lineno=None, colno=None, end_colno=None)
503505

504506
Represents a single :ref:`frame <frame-objects>` in the
505507
:ref:`traceback <traceback-objects>` or stack that is being formatted
@@ -535,6 +537,22 @@ in a :ref:`traceback <traceback-objects>`.
535537
trailing whitespace stripped.
536538
If the source is not available, it is ``None``.
537539

540+
.. attribute:: FrameSummary.end_lineno
541+
542+
The last line number of the source code for this frame.
543+
By default, it is set to ``lineno`` and indexation starts from 1.
544+
545+
.. attribute:: FrameSummary.colno
546+
547+
The column number of the source code for this frame.
548+
By default, it is ``None`` and indexation starts from 0.
549+
550+
.. attribute:: FrameSummary.end_colno
551+
552+
The last column number of the source code for this frame.
553+
By default, it is ``None`` and indexation starts from 0.
554+
555+
538556
.. _traceback-example:
539557

540558
Examples of Using the Module-Level Functions

0 commit comments

Comments
 (0)
Please sign in to comment.