New submission from STINNER Victor: Test attached unittest_leak.py script: you will see MyException.ninstance counter increased up to 10, whereas I expect that MyException is destroyed at TestCase.run() exit.
It looks like a tricky reference cycle between: - frames - exc_info local variable of _Outcome.testPartExecutor() context manager - _Outcome.errors list - _Outclass instance Attached unittest_workaround.patch patch works around the issue. ---------- files: unittest_leak.py messages: 205167 nosy: haypo, pitrou priority: normal severity: normal status: open title: unittest: on failure, TestCase.run() keeps a reference to the exception versions: Python 3.4 Added file: http://bugs.python.org/file32951/unittest_leak.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19880> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com