bpo-32121: Add most_recent_first parameter to tracemalloc.Traceback.format (#4534)

* Add most_recent_first parameter to tracemalloc.Traceback.format to allow
   reversing the order of the frames in the output
* Reversed default sorting of tracemalloc.Traceback frames
* Allowed negative limit, truncating from the other side.
This commit is contained in:
Jesse-Bakker 2017-11-30 00:05:07 +01:00 committed by Victor Stinner
parent 859f7ce7a4
commit 706e10b186
7 changed files with 70 additions and 26 deletions

View file

@ -62,7 +62,7 @@ def _formatwarnmsg_impl(msg):
tb = None
if tb is not None:
s += 'Object allocated at (most recent call first):\n'
s += 'Object allocated at (most recent call last):\n'
for frame in tb:
s += (' File "%s", lineno %s\n'
% (frame.filename, frame.lineno))