This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: traceback.print_exc return value documentation
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder: Doc/library/traceback.rst — references to tuples should be replaced with new FrameSummary object
View: 27910
Assigned To: docs@python Nosy List: JelleZijlstra, berker.peksag, docs@python
Priority: normal Keywords:

Created on 2017-07-21 15:32 by JelleZijlstra, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg298807 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2017-07-21 15:32
The documentation for traceback.format_tb says "Return a list of “pre-processed” stack trace entries extracted from the traceback object tb. It is useful for alternate formatting of stack traces. The optional limit argument has the same meaning as for print_tb(). A “pre-processed” stack trace entry is a 4-tuple (filename, line number, function name, text) representing the information that is usually printed for a stack trace."

However, as of 3.5 it actually returns a StackSummary object, which is a subclass of list and contains FrameSummary objects. FrameSummary objects are not tuples. The documentation is accurate for 3.4 and earlier. I'm surprised this change was made because it seems like a compatibility break, but it's too late to do something about that now.

The documentation should be changed to correct the return value and add a "versionchanged: 3.5" note.
msg322973 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-02 15:57
The documentation you've quoted is for traceback.extract_tb(). traceback.format_tb() documentation only says:

    A shorthand for ``format_list(extract_tb(tb, limit))``.

Issue 27910 is about updating the documentation of extract_tb(), format_list(), and StackSummary.from_list().

I'm closing this as a duplicate of issue 27910.
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75167
2018-08-02 15:57:41berker.peksagsetstatus: open -> closed

superseder: Doc/library/traceback.rst — references to tuples should be replaced with new FrameSummary object
type: behavior

nosy: + berker.peksag
messages: + msg322973
resolution: duplicate
stage: resolved
2017-07-21 15:32:50JelleZijlstracreate