diff options
author | Adam Johnson <me@adamj.eu> | 2020-03-10 18:18:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 19:18:50 +0100 |
commit | d06eec218eac81225f9017951cddfc211fed9325 (patch) | |
tree | e6d52c7aecc01c4c9fff682ed2e23e27f1933ef7 /Doc/library | |
parent | 13d52c268699f199a8e917a0f1dc4c51e5346c42 (diff) | |
download | cpython-git-d06eec218eac81225f9017951cddfc211fed9325.tar.gz |
tracemalloc: 'pretty top' example no longer changes the filename (GH-18903)
I've used this recipe a couple times and the filename editing has always
been less than useful and something I've removed. This is because many
modules end up losing which package they are located in, e.g. `util/date.py`.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/tracemalloc.rst | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst index e423470036..3eee9457fb 100644 --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -202,10 +202,8 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files:: print("Top %s lines" % limit) for index, stat in enumerate(top_stats[:limit], 1): frame = stat.traceback[0] - # replace "/path/to/module/file.py" with "module/file.py" - filename = os.sep.join(frame.filename.split(os.sep)[-2:]) print("#%s: %s:%s: %.1f KiB" - % (index, filename, frame.lineno, stat.size / 1024)) + % (index, frame.filename, frame.lineno, stat.size / 1024)) line = linecache.getline(frame.filename, frame.lineno).strip() if line: print(' %s' % line) |