summaryrefslogtreecommitdiff
path: root/Objects/object.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-07-03 21:03:53 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-07-03 21:03:53 +0300
commit7e160ce356036bccda2608d9ee10bfe276dfa97a (patch)
tree8c5ff466786f788afa0d8400c8d8c57211e85cdb /Objects/object.c
parent6c94d10a193ffdaad9d3b7c2376d9f4de776575f (diff)
downloadcpython-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/object.c')
-rw-r--r--Objects/object.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c
index c83c8ec06f..559794f5b4 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -109,6 +109,15 @@ void
dump_counts(FILE* f)
{
PyTypeObject *tp;
+ PyObject *xoptions, *value;
+ _Py_IDENTIFIER(showalloccount);
+
+ xoptions = PySys_GetXOptions();
+ if (xoptions == NULL)
+ return;
+ value = _PyDict_GetItemId(xoptions, &PyId_showalloccount);
+ if (value != Py_True)
+ return;
for (tp = type_list; tp; tp = tp->tp_next)
fprintf(f, "%s alloc'd: %" PY_FORMAT_SIZE_T "d, "