mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Docstring clarifications.
This commit is contained in:
parent
aa86e35c52
commit
53f72d7dcd
1 changed files with 12 additions and 7 deletions
|
@ -10,7 +10,8 @@ time Py_Finalize() prints the list of all live objects twice: first it
|
||||||
prints the repr() of each object while the interpreter is still fully intact.
|
prints the repr() of each object while the interpreter is still fully intact.
|
||||||
After cleaning up everything it can, it prints all remaining live objects
|
After cleaning up everything it can, it prints all remaining live objects
|
||||||
again, but the second time just prints their addresses, refcounts, and type
|
again, but the second time just prints their addresses, refcounts, and type
|
||||||
names.
|
names (because the interpreter has been torn down, calling repr methods at
|
||||||
|
this point can get into infinite loops or blow up).
|
||||||
|
|
||||||
Save all this output into a file, then run this script passing the path to
|
Save all this output into a file, then run this script passing the path to
|
||||||
that file. The script finds both output chunks, combines them, then prints
|
that file. The script finds both output chunks, combines them, then prints
|
||||||
|
@ -36,6 +37,12 @@ typename is object->ob_type->tp_name, extracted from the second PYTHONDUMPREFS
|
||||||
output block.
|
output block.
|
||||||
|
|
||||||
repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
|
repr is repr(object), extracted from the first PYTHONDUMPREFS output block.
|
||||||
|
CAUTION: If object is a container type, it may not actually contain all the
|
||||||
|
objects shown in the repr: the repr was captured from the first output block,
|
||||||
|
and some of the containees may have been released since then. For example,
|
||||||
|
it's common for the line showing the dict of interned strings to display
|
||||||
|
strings that no longer exist at the end of Py_Finalize; this can be recognized
|
||||||
|
(albeit painfully) because such containees don't have a line of their own.
|
||||||
|
|
||||||
The objects are listed in allocation order, with most-recently allocated
|
The objects are listed in allocation order, with most-recently allocated
|
||||||
printed first, and the first object allocated printed last.
|
printed first, and the first object allocated printed last.
|
||||||
|
@ -57,12 +64,10 @@ between the times PYTHONDUMPREFS produced output.
|
||||||
|
|
||||||
00858028 [1025->1456] str '<dummy key>'
|
00858028 [1025->1456] str '<dummy key>'
|
||||||
|
|
||||||
The string '<dummy key>', which is used in dictobject.c as the name of the
|
The string '<dummy key>', which is used in dictobject.c to overwrite a real
|
||||||
dummy key that overwrites a real key that gets deleted, actually grew
|
key that gets deleted, grew several hundred references during cleanup. It
|
||||||
several hundred references during cleanup. It suggests that stuff did get
|
suggests that stuff did get removed from dicts by cleanup, but that the dicts
|
||||||
removed from dicts by cleanup, but that the dicts themselves are staying
|
themselves are staying alive for some reason. """
|
||||||
alive for some reason.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue