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