e32ce18
diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c
e32ce18
--- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS	2010-08-17 14:49:33.321913909 -0400
e32ce18
+++ Python-2.7/Python/pythonrun.c	2010-08-17 14:54:48.750910403 -0400
e32ce18
@@ -470,7 +470,15 @@ Py_Finalize(void)
e32ce18
 
e32ce18
     /* Debugging stuff */
e32ce18
 #ifdef COUNT_ALLOCS
e32ce18
-    dump_counts(stdout);
e32ce18
+    /* This is a downstream Fedora modification.
e32ce18
+       The upstream default with COUNT_ALLOCS is to always dump the counts to
e32ce18
+       stdout on exit.  For our debug builds its useful to have the info from
e32ce18
+       COUNT_ALLOCS available, but the stdout info here gets in the way, so
e32ce18
+       we make it optional, wrapping it in an environment variable (modelled
e32ce18
+       on the other PYTHONDUMP* env variables):
e32ce18
+    */
e32ce18
+    if (Py_GETENV("PYTHONDUMPCOUNTS"))
e32ce18
+        dump_counts(stdout);
e32ce18
 #endif
e32ce18
     /* dump hash stats */
e32ce18
     _PyHash_Fini();