This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tracemalloc example - Pretty Top
Type: Stage: resolved
Components: Documentation Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Jeong-Min.Lee, docs@python, python-dev, vstinner
Priority: normal Keywords:

Created on 2014-03-01 09:06 by Jeong-Min.Lee, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg212493 - (view) Author: Jeong-Min Lee (Jeong-Min.Lee) Date: 2014-03-01 09:06
Running the Pretty top example (http://docs.python.org/dev/library/tracemalloc.html#pretty-top) in the tracemalloc module documentation causes a ValueError.


    Traceback (most recent call last):
      File "t.py", line 32, in <module>
        display_top(snapshot, 10)
      File "t.py", line 9, in display_top
        top_stats = snapshot.statistics(group_by)
      File "/home/falsetru/h/cpython/Lib/tracemalloc.py", line 449, in statistics
        grouped = self._group_by(key_type, cumulative)
      File "/home/falsetru/h/cpython/Lib/tracemalloc.py", line 395, in _group_by
        raise ValueError("unknown key_type: %r" % (key_type,))
    ValueError: unknown key_type: 10

The last line of the example should be:

    display_top(snapshot, limit=10)

or:

    display_top(snapshop)
msg212627 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-03 10:58
New changeset a9058b772807 by Victor Stinner in branch 'default':
Close #20814: doc: Fix "Pretty top" example of tracemalloc
http://hg.python.org/cpython/rev/a9058b772807
msg212628 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-03-03 10:59
Thank you Jeong-Min for your report, it's now fixed.
msg213836 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-03-17 06:31
New changeset 027ca483a7e5 by Victor Stinner in branch '3.4':
Close #20814: doc: Fix "Pretty top" example of tracemalloc
http://hg.python.org/cpython/rev/027ca483a7e5
History
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 65013
2014-03-17 06:31:13python-devsetmessages: + msg213836
2014-03-03 13:25:45berker.peksagsetresolution: fixed
stage: resolved
2014-03-03 12:20:02georg.brandlsetstatus: open -> closed
2014-03-03 10:59:34vstinnersetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg212628

stage: resolved -> (no value)
2014-03-03 10:58:52python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg212627

resolution: fixed
stage: resolved
2014-03-01 09:36:30berker.peksagsetnosy: + vstinner

versions: - Python 3.5
2014-03-01 09:14:51Jeong-Min.Leesettitle: tracemalloc example -> tracemalloc example - Pretty Top
2014-03-01 09:06:39Jeong-Min.Leecreate