Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53f72d7

Browse files
committed
Docstring clarifications.
1 parent aa86e35 commit 53f72d7

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

Tools/scripts/combinerefs.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
prints the repr() of each object while the interpreter is still fully intact.
1111
After cleaning up everything it can, it prints all remaining live objects
1212
again, but the second time just prints their addresses, refcounts, and type
13-
names.
13+
names (because the interpreter has been torn down, calling repr methods at
14+
this point can get into infinite loops or blow up).
1415
1516
Save all this output into a file, then run this script passing the path to
1617
that file. The script finds both output chunks, combines them, then prints
@@ -36,6 +37,12 @@
3637
output block.
3738
3839
repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
40+
CAUTION: If object is a container type, it may not actually contain all the
41+
objects shown in the repr: the repr was captured from the first output block,
42+
and some of the containees may have been released since then. For example,
43+
it's common for the line showing the dict of interned strings to display
44+
strings that no longer exist at the end of Py_Finalize; this can be recognized
45+
(albeit painfully) because such containees don't have a line of their own.
3946
4047
The objects are listed in allocation order, with most-recently allocated
4148
printed first, and the first object allocated printed last.
@@ -57,12 +64,10 @@
5764
5865
00858028 [1025->1456] str '<dummy key>'
5966
60-
The string '<dummy key>', which is used in dictobject.c as the name of the
61-
dummy key that overwrites a real key that gets deleted, actually grew
62-
several hundred references during cleanup. It suggests that stuff did get
63-
removed from dicts by cleanup, but that the dicts themselves are staying
64-
alive for some reason.
65-
"""
67+
The string '<dummy key>', which is used in dictobject.c to overwrite a real
68+
key that gets deleted, grew several hundred references during cleanup. It
69+
suggests that stuff did get removed from dicts by cleanup, but that the dicts
70+
themselves are staying alive for some reason. """
6671

6772
import re
6873
import sys

0 commit comments

Comments
 (0)