[Python-checkins] [3.8] bpo-37990: fix gc stats (GH-15626)

Inada Naoki webhook-mailer at python.org
Fri Aug 30 21:50:33 EDT 2019


https://github.com/python/cpython/commit/97a31c7b486c45ba9c21cab5fb96337859a60275
commit: 97a31c7b486c45ba9c21cab5fb96337859a60275
branch: 3.8
author: Inada Naoki <songofacandy at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-08-31T10:50:27+09:00
summary:

[3.8] bpo-37990: fix gc stats (GH-15626)

(cherry picked from commit 013e52f)

files:
A Misc/NEWS.d/next/Core and Builtins/2019-08-31-09-22-33.bpo-37990.WDY2f-.rst
M Modules/gcmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-08-31-09-22-33.bpo-37990.WDY2f-.rst b/Misc/NEWS.d/next/Core and Builtins/2019-08-31-09-22-33.bpo-37990.WDY2f-.rst
new file mode 100644
index 000000000000..39edc595418e
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-08-31-09-22-33.bpo-37990.WDY2f-.rst	
@@ -0,0 +1,2 @@
+Fix elapsed time in gc stats was not printed correctly.  This bug was
+a regression in 3.8b4.
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 21839d95bd8c..2741edc0a021 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -1115,8 +1115,9 @@ collect(struct _gc_runtime_state *state, int generation,
     }
     if (state->debug & DEBUG_STATS) {
         double d = _PyTime_AsSecondsDouble(_PyTime_GetMonotonicClock() - t1);
-        PySys_FormatStderr(
-            "gc: done, %zd unreachable, %zd uncollectable, %.4fs elapsed\n",
+        PySys_WriteStderr(
+            "gc: done, %" PY_FORMAT_SIZE_T "d unreachable, "
+            "%" PY_FORMAT_SIZE_T "d uncollectable, %.4fs elapsed\n",
             n+m, n, d);
     }
 



More information about the Python-checkins mailing list