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:

Python tracker <>
Python-bugs-list mailing list

Reply via email to