summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-06-29 08:32:49 (GMT)
committerGitHub <noreply@github.com>2017-06-29 08:32:49 (GMT)
commitbeeca6e1e5fd01531b1db7059498b13d07dca525 (patch)
tree96497db7c5d32fe18c3824a477816a49c1faa335
parent6b42eb17649bed9615b6e6cecaefdb2f46990b2c (diff)
downloadcpython-beeca6e1e5fd01531b1db7059498b13d07dca525.zip
cpython-beeca6e1e5fd01531b1db7059498b13d07dca525.tar.gz
cpython-beeca6e1e5fd01531b1db7059498b13d07dca525.tar.bz2
bpo-30776: regrtest: reduce memleak false positive (#2484)
Only report a leak if each run leaks at least one memory block.
-rw-r--r--Lib/test/libregrtest/refleak.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index 8e18d75..8e93816 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -96,6 +96,8 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
# These checkers return False on success, True on failure
def check_rc_deltas(deltas):
+ # Checker for reference counters and memomry blocks.
+ #
# bpo-30776: Try to ignore false positives:
#
# [3, 0, 0]
@@ -108,22 +110,13 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
# [10, 1, 1]
return all(delta >= 1 for delta in deltas)
- def check_alloc_deltas(deltas):
- # At least 1/3rd of 0s
- if 3 * deltas.count(0) < len(deltas):
- return True
- # Nothing else than 1s, 0s and -1s
- if not set(deltas) <= {1,0,-1}:
- return True
- return False
-
def check_fd_deltas(deltas):
return any(deltas)
failed = False
for deltas, item_name, checker in [
(rc_deltas, 'references', check_rc_deltas),
- (alloc_deltas, 'memory blocks', check_alloc_deltas),
+ (alloc_deltas, 'memory blocks', check_rc_deltas),
(fd_deltas, 'file descriptors', check_fd_deltas)
]:
# ignore warmup runs