This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients brett.cannon, pitrou, vstinner, zach.ware
Date 2017-09-01.00:03:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1504224238.36.0.35214655531.issue31217@psf.upfronthosting.co.za>
In-reply-to
Content
This patch does the trick:

diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index efe5210..68e490a 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -48,6 +48,11 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
     print("beginning", repcount, "repetitions", file=sys.stderr)
     print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr,
           flush=True)
+
+    int_pool = {i: i for i in range(-1000, 1000)}
+    def get_pooled_int(v):
+        return int_pool.setdefault(v, v)
+
     # initialize variables to make pyflakes quiet
     rc_before = alloc_before = fd_before = 0
     for i in range(repcount):
@@ -56,9 +61,9 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
                                                          abcs)
         print('.', end='', file=sys.stderr, flush=True)
         if i >= nwarmup:
-            rc_deltas[i] = rc_after - rc_before
-            alloc_deltas[i] = alloc_after - alloc_before
-            fd_deltas[i] = fd_after - fd_before
+            rc_deltas[i] = get_pooled_int(rc_after - rc_before)
+            alloc_deltas[i] = get_pooled_int(alloc_after - alloc_before)
+            fd_deltas[i] = get_pooled_int(fd_after - fd_before)
         alloc_before = alloc_after
         rc_before = rc_after
         fd_before = fd_after
History
Date User Action Args
2017-09-01 00:03:58pitrousetrecipients: + pitrou, brett.cannon, vstinner, zach.ware
2017-09-01 00:03:58pitrousetmessageid: <1504224238.36.0.35214655531.issue31217@psf.upfronthosting.co.za>
2017-09-01 00:03:58pitroulinkissue31217 messages
2017-09-01 00:03:57pitroucreate