[New-bugs-announce] [issue30547] [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references

STINNER Victor report at bugs.python.org
Fri Jun 2 04:58:24 EDT 2017


New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/15/steps/test/logs/stdio

0:02:58 [ 28/405/2] test_atexit failed
......
beginning 6 repetitions
123456

test_atexit leaked [12, 12, 12] references, sum=36
test_atexit leaked [4, 4, 4] memory blocks, sum=12


Code of of the test:

    def test_callbacks_leak(self):
        # This test shows a leak in refleak mode if atexit doesn't
        # take care to free callbacks in its per-subinterpreter module
        # state.
        n = atexit._ncallbacks()
        code = r"""if 1:
            import atexit
            def f():
                pass
            atexit.register(f)
            del atexit
            """
        ret = support.run_in_subinterp(code)
        self.assertEqual(ret, 0)
        self.assertEqual(atexit._ncallbacks(), n)


Hum, I don't understand: the test leaks references on purpose?


To reproduce the bug, use the command:

python -m test -R 3:3 -m test_callbacks_leak test_atexit


Note: Leak isolated my bisect_test.py of bpo-29512.

----------
components: Tests, Windows
messages: 294990
nosy: eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references
type: resource usage
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30547>
_______________________________________


More information about the New-bugs-announce mailing list