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