summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-07-03 18:03:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-07-03 18:03:53 (GMT)
commit7e160ce356036bccda2608d9ee10bfe276dfa97a (patch)
tree8c5ff466786f788afa0d8400c8d8c57211e85cdb /Objects/tupleobject.c
parent6c94d10a193ffdaad9d3b7c2376d9f4de776575f (diff)
downloadcpython-7e160ce356036bccda2608d9ee10bfe276dfa97a.zip
cpython-7e160ce356036bccda2608d9ee10bfe276dfa97a.tar.gz
cpython-7e160ce356036bccda2608d9ee10bfe276dfa97a.tar.bz2
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/tupleobject.c')
-rw-r--r--Objects/tupleobject.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index a7774e2..1b41258 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -36,6 +36,16 @@ static Py_ssize_t count_tracked = 0;
static void
show_track(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, "Tuples created: %" PY_FORMAT_SIZE_T "d\n",
count_tracked + count_untracked);
fprintf(stderr, "Tuples tracked by the GC: %" PY_FORMAT_SIZE_T