[issue22166] test_codecs leaks references

Nick Coghlan report at bugs.python.org
Sat Sep 6 14:45:10 CEST 2014


Nick Coghlan added the comment:

Yep, it looks like the mess with the reference cycles in the tracebacks was just a secondary problem: the real culprit was the internal cache keeping everything else alive.

Attached patch just adds clearing encodings._cache and the CPython internal cache to the ExceptionChainingTest.tearDown() method.

The latter is accomplised via gc.get_referrers() and popping the codec's name from any dict remaining in that list after clearing the known caches, so it will actually handle any hidden name based caches on any interpreter.

----------
Added file: http://bugs.python.org/file36560/issue22166_clear_internal_cache.diff

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


More information about the Python-bugs-list mailing list