summaryrefslogtreecommitdiffstats
path: root/Doc/library/tracemalloc.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/tracemalloc.rst')
-rw-r--r--Doc/library/tracemalloc.rst18
1 files changed, 12 insertions, 6 deletions
diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst
index 048ee64..2d327c0 100644
--- a/Doc/library/tracemalloc.rst
+++ b/Doc/library/tracemalloc.rst
@@ -650,8 +650,8 @@ Traceback
.. class:: Traceback
- Sequence of :class:`Frame` instances sorted from the most recent frame to
- the oldest frame.
+ Sequence of :class:`Frame` instances sorted from the oldest frame to the
+ most recent frame.
A traceback contains at least ``1`` frame. If the ``tracemalloc`` module
failed to get a frame, the filename ``"<unknown>"`` at line number ``0`` is
@@ -663,11 +663,17 @@ Traceback
The :attr:`Trace.traceback` attribute is an instance of :class:`Traceback`
instance.
- .. method:: format(limit=None)
+ .. versionchanged:: 3.7
+ Frames are now sorted from the oldest to the most recent, instead of most recent to oldest.
- Format the traceback as a list of lines with newlines. Use the
- :mod:`linecache` module to retrieve lines from the source code. If
- *limit* is set, only format the *limit* most recent frames.
+ .. method:: format(limit=None, most_recent_first=False)
+
+ Format the traceback as a list of lines with newlines. Use the
+ :mod:`linecache` module to retrieve lines from the source code.
+ If *limit* is set, format the *limit* most recent frames if *limit*
+ is positive. Otherwise, format the ``abs(limit)`` oldest frames.
+ If *most_recent_first* is ``True``, the order of the formatted frames
+ is reversed, returning the most recent frame first instead of last.
Similar to the :func:`traceback.format_tb` function, except that
:meth:`.format` does not include newlines.