summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-10-17 09:25:23 (GMT)
committerGitHub <noreply@github.com>2017-10-17 09:25:23 (GMT)
commit7b4ba62e388474e811268322b47f80d464933541 (patch)
tree7d0ba89d476fe68d2d6901ed341e00ec8d43a9e6 /Python/pythonrun.c
parent3c082a7fdb472f02bcac7a7f8fe1e3a34a11b70b (diff)
downloadcpython-7b4ba62e388474e811268322b47f80d464933541.zip
cpython-7b4ba62e388474e811268322b47f80d464933541.tar.gz
cpython-7b4ba62e388474e811268322b47f80d464933541.tar.bz2
[2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var (GH-3927)
bpo-31692, bpo-19527: * Add a new PYTHONSHOWALLOCCOUNT environment variable, similar to the Python 3 "-X showalloccount" option * When Python is compiled with COUNT_ALLOCS, the new PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump allocation counts into stderr on shutdown. Moreover, allocations statistics are now dumped into stderr rather than stdout. * Add @test.support.requires_type_collecting decorator: skip test if COUNT_ALLOCS is defined * Fix tests for COUNT_ALLOCS: decorate some methods with @requires_type_collecting * test_sys.test_objecttypes(): update object type when COUNT_ALLOCS is defined
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 677f6e4..44fe13d 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -488,7 +488,9 @@ Py_Finalize(void)
/* Debugging stuff */
#ifdef COUNT_ALLOCS
- dump_counts(stdout);
+ if (Py_GETENV("PYTHONSHOWALLOCCOUNT")) {
+ dump_counts(stderr);
+ }
#endif
_PyDebug_PrintTotalRefs();