STINNER Victor added the comment: > It may be related to the issue #17911.
I checked: it is. The strange reference count can be seen with a single test. Example: $ ./python -m test -R 3:3: -m test_default_exc_handler_coro test_asyncio [1/1] test_asyncio beginning 6 repetitions 123456 ...... test_asyncio leaked [53, 53, -106] references, sum=0 test_asyncio leaked [15, 15, -30] memory blocks, sum=0 1 test failed: test_asyncio This test uses a coroutine which raises an exception. The exception is stored in a Task object. But the exception contains also a traceback which indirectly creates a reference cycle. For example, the zero_error_coro() coroutine of the test uses the free variable "self". It's very difficult to find all objects of a reference cycle. We can try to break some cycles, it's already done Task._step() which sets self to None, but it's a waste of time. IMO the correct fix is to not store frame objects in an exception: see the issue #17911. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22104> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com