[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 11:54:43 EST 2019


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

Extract of the crashing test:

    def test_cmp(self):
        ...

        class Exc(Exception):
            pass

        class BadCmp(object):
            def __eq__(self, other):
                raise Exc

        s1 = slice(BadCmp())
        s2 = slice(BadCmp())
        self.assertEqual(s1, s1)
        self.assertRaises(Exc, lambda: s1 == s2)   # <==== CRASH HERE

        ...

The latest change in test_slice.py has been made in 2016: 3 years ago.

Latest changes in Objects/sliceobject.c were refactoring related to header files (november 2018). The latest "significant" change was done in April 2018: "bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS".

I bet more on a recent change which is not directly related to slices... like the implementation of the PEP 572? It would help to know when the crash started to occur exactly (date + time).

----------

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


More information about the Python-bugs-list mailing list