[issue30984] traceback.print_exc return value documentation
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
New submission from Jelle Zijlstra: 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. ---------- assignee: docs@python components: Documentation messages: 298807 nosy: Jelle Zijlstra, docs@python priority: normal severity: normal status: open title: traceback.print_exc return value documentation versions: Python 3.6, Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue30984> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Berker Peksag <berker.peksag@gmail.com> added the comment: 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. ---------- nosy: +berker.peksag resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Doc/library/traceback.rst — references to tuples should be replaced with new FrameSummary object type: -> behavior _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue30984> _______________________________________
participants (2)
-
Berker Peksag
-
Jelle Zijlstra