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