[issue35961] test_slice: gc_decref: Assertion "gc_get_refs(g) > 0" failed: refcount is too small

STINNER Victor report at bugs.python.org
Tue Feb 12 13:46:48 EST 2019


STINNER Victor <vstinner at redhat.com> added the comment:

It's impressive *and* scary that such 13 years old bug only show up today...

I modified the GC threshold in the site module with this patch:

diff --git a/Lib/site.py b/Lib/site.py
index ad1146332b..68cdf105b1 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -557,6 +557,10 @@ def main():
     This function is called automatically when this module is imported,
     unless the python interpreter was started with the -S flag.
     """
+    import gc, random
+    n = random.randint(5, 100)
+    gc.set_threshold(n)
+
     global ENABLE_USER_SITE
 
     orig_path = sys.path[:]


Running the test suite with this patch doesn't catch the bug :-(

$ ./python -m test -j0 -r -u all,-gui

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35961>
_______________________________________


More information about the Python-bugs-list mailing list