STINNER Victor added the comment:
> So the first non-zero alloc_delta really has a snowball effect, as it creates
> new memory block which will produce a non-zero alloc_delta on the next run,
> etc.
Oh, I suspected an issue around this code but I was unable to explain it. I
focused strongly on test_current_frames(), whereas this function is just
fine... It's really strange that the bug only triggers on very specific
conditions.
"""
Actually, it's quite simple :-) On 64-bit Python:
>>> id(82914 - 82913) == id(1)
True
On 32-bit Python:
>>> id(82914 - 82913) == id(1)
False
"""
That's very strange.
Another workaround:
diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py
index efe52107cb..35d3f8e42d 100644
--- a/Lib/test/libregrtest/refleak.py
+++ b/Lib/test/libregrtest/refleak.py
@@ -56,9 +56,10 @@ 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
+ def maybe_small_long(x): return int(str(x))
+ rc_deltas[i] = maybe_small_long(rc_after - rc_before)
+ alloc_deltas[i] = maybe_small_long(alloc_after - alloc_before)
+ fd_deltas[i] = maybe_small_long(fd_after - fd_before)
alloc_before = alloc_after
rc_before = rc_after
fd_before = fd_after
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue31217>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com