diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-03 21:03:53 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-03 21:03:53 +0300 |
commit | 7e160ce356036bccda2608d9ee10bfe276dfa97a (patch) | |
tree | 8c5ff466786f788afa0d8400c8d8c57211e85cdb /Objects/listobject.c | |
parent | 6c94d10a193ffdaad9d3b7c2376d9f4de776575f (diff) | |
download | cpython-git-7e160ce356036bccda2608d9ee10bfe276dfa97a.tar.gz |
Issue #23034: The output of a special Python build with defined COUNT_ALLOCS,
SHOW_ALLOC_COUNT or SHOW_TRACK_COUNT macros is now off by default. It can
be re-enabled using the "-X showalloccount" option. It now outputs to stderr
instead of stdout.
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 6e2d026e95..ddc0fee41a 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -82,6 +82,16 @@ static size_t count_reuse = 0; static void show_alloc(void) { + PyObject *xoptions, *value; + _Py_IDENTIFIER(showalloccount); + + xoptions = PySys_GetXOptions(); + if (xoptions == NULL) + return; + value = _PyDict_GetItemId(xoptions, &PyId_showalloccount); + if (value != Py_True) + return; + fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n", count_alloc); fprintf(stderr, "List reuse through freelist: %" PY_FORMAT_SIZE_T |