Kaydet (Commit) f70200e5 authored tarafından Victor Stinner's avatar Victor Stinner

Close #20814: doc: Fix "Pretty top" example of tracemalloc

üst 8be77910
...@@ -200,8 +200,7 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files:: ...@@ -200,8 +200,7 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files::
# replace "/path/to/module/file.py" with "module/file.py" # replace "/path/to/module/file.py" with "module/file.py"
filename = os.sep.join(frame.filename.split(os.sep)[-2:]) filename = os.sep.join(frame.filename.split(os.sep)[-2:])
print("#%s: %s:%s: %.1f KiB" print("#%s: %s:%s: %.1f KiB"
% (index, filename, frame.lineno, % (index, filename, frame.lineno, stat.size / 1024))
stat.size / 1024))
other = top_stats[limit:] other = top_stats[limit:]
if other: if other:
...@@ -215,7 +214,7 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files:: ...@@ -215,7 +214,7 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files::
# ... run your application ... # ... run your application ...
snapshot = tracemalloc.take_snapshot() snapshot = tracemalloc.take_snapshot()
display_top(snapshot, 10) display_top(snapshot)
Example of output of the Python test suite:: Example of output of the Python test suite::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment