[issue22166] test_codecs "leaking" references

2014-09-01 Thread STINNER Victor
STINNER Victor added the comment: ExceptionChainingTest uses a function to raise an arbitrary exception. Problem: the function and its parameter becomes part of the exception traceback. Shortly, the exception links indirectly to itself in a nice reference cycle... Example: --- import traceback

[issue22166] test_codecs "leaking" references

2014-08-13 Thread Nick Coghlan
Nick Coghlan added the comment: I assigned this to myself when I thought this was going to be an easy fix (since I knew encodings._cache wasn't getting cleared), but it looks substantially more complicated than that. I checked the codec entry was getting cleared by tearDown() correctly, and e

[issue22166] test_codecs "leaking" references

2014-08-13 Thread Nick Coghlan
Nick Coghlan added the comment: Still not sure what is going on, but I tweaked my tracemalloc hacks based on Victor's draft patch in 19816 (his are designed to make this optional, where mine are hardcoded. I also sort by number of allocations, rather than amount of memory) -- Added fi

[issue22166] test_codecs "leaking" references

2014-08-13 Thread Nick Coghlan
Nick Coghlan added the comment: I did a bit of poking around with tracemalloc (debugging patch diff attached) encodings._cache is definitely one culprit, but something else is going on where it appears the *test cases* are being kept alive. For comparison, with my hacked regrtest, I get this f

[issue22166] test_codecs "leaking" references

2014-08-07 Thread Zachary Ware
New submission from Zachary Ware: After 9bca86812857 (#22104), test_codecs now reports "leaked" references from ExceptionChainingTest. Previously the tests were only ever loaded one time, so each run of the tests was actually using the same set of TestCase instances; now the tests are freshly