https://github.com/python/cpython/commit/dc192869b67e5fef086970dc82cbdb0caeb32a1a
commit: dc192869b67e5fef086970dc82cbdb0caeb32a1a
branch: main
author: Inada Naoki <[email protected]>
committer: methane <[email protected]>
date: 2026-11-12T16:23:42+09:00
summary:
gh-140456: Doc: Clarify traceback source lines and tuple inputs (#161801)
files:
M Doc/library/traceback.rst
diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst
index 8f167eb3524db2..9e1be62c568ea1 100644
--- a/Doc/library/traceback.rst
+++ b/Doc/library/traceback.rst
@@ -157,16 +157,19 @@ Module-Level Functions
.. function:: print_list(extracted_list, file=None)
- Print the list of tuples as returned by :func:`extract_tb` or
- :func:`extract_stack` as a formatted stack trace to the given file.
+ Print a list of :class:`FrameSummary` objects as returned by
+ :func:`extract_tb` or :func:`extract_stack`, or a list of old-style tuples
+ (see :meth:`StackSummary.from_list`), as a formatted stack trace to the
+ given file.
If *file* is ``None``, the output is written to :data:`sys.stderr`.
.. function:: format_list(extracted_list)
- Given a list of tuples or :class:`FrameSummary` objects as returned by
- :func:`extract_tb` or :func:`extract_stack`, return a list of strings ready
- for printing. Each string in the resulting list corresponds to the item
with
+ Given a list of :class:`FrameSummary` objects as returned by
+ :func:`extract_tb` or :func:`extract_stack`, or a list of old-style tuples
+ (see :meth:`StackSummary.from_list`), return a list of strings ready for
+ printing. Each string in the resulting list corresponds to the item with
the same index in the argument list. Each string ends in a newline; the
strings may contain internal newlines as well, for those items whose source
text line is not ``None``.
@@ -536,8 +539,8 @@ in a :ref:`traceback <traceback-objects>`.
.. attribute:: FrameSummary.line
- A string representing the source code for this frame, with leading and
- trailing whitespace stripped.
+ The source line at :attr:`~FrameSummary.lineno`,
+ with leading and trailing whitespace stripped.
If the source is not available, it is ``None``.
.. attribute:: FrameSummary.end_lineno
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]