Skip to content

Commit a1d087c

Browse files
Damien-Chenmiss-islington
authored andcommitted
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 c192944 commit a1d087c

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
@@ -478,7 +478,9 @@ the module-level functions described above.
478478
A :class:`!FrameSummary` object represents a single :ref:`frame <frame-objects>`
479479
in a :ref:`traceback <traceback-objects>`.
480480

481-
.. class:: FrameSummary(filename, lineno, name, lookup_line=True, locals=None, line=None)
481+
.. class:: FrameSummary(filename, lineno, name, *,\
482+
lookup_line=True, locals=None,\
483+
line=None, end_lineno=None, colno=None, end_colno=None)
482484

483485
Represents a single :ref:`frame <frame-objects>` in the
484486
:ref:`traceback <traceback-objects>` or stack that is being formatted
@@ -514,6 +516,22 @@ in a :ref:`traceback <traceback-objects>`.
514516
trailing whitespace stripped.
515517
If the source is not available, it is ``None``.
516518

519+
.. attribute:: FrameSummary.end_lineno
520+
521+
The last line number of the source code for this frame.
522+
By default, it is set to ``lineno`` and indexation starts from 1.
523+
524+
.. attribute:: FrameSummary.colno
525+
526+
The column number of the source code for this frame.
527+
By default, it is ``None`` and indexation starts from 0.
528+
529+
.. attribute:: FrameSummary.end_colno
530+
531+
The last column number of the source code for this frame.
532+
By default, it is ``None`` and indexation starts from 0.
533+
534+
517535
.. _traceback-example:
518536

519537
Examples of Using the Module-Level Functions

0 commit comments

Comments
 (0)