This patch improves generator finalization such that simple generators (without active try/except/finally blocks surrounding yield statements) can have their cycles broken. Please check to see if this patch improves the leaks that prompted the request for changing this. Thanks.
Logged In: YES user_id=31435 There's no uploaded file! You have to check the checkbox labeled "Check to Upload & Attach File" when you upload a file. In addition, even if you *did* check this checkbox, a bug in SourceForge prevents attaching a file when *creating* an issue. Please try again. (This is a SourceForge annoyance that we can do nothing about. :-( )
Logged In: YES user_id=34209 The patch looks alright (although it could use some big blinking comments in opcode.h and ceval.c, to make sure PyGen_NeedsFinalizer is properly updated when new block types are added.) The patch fixes the test_generators_cycle.py leaker-test, but it does *not* fix the cycles test_generators test. (Obviously after removing the code that explicitly breaks the cycle in test_generators.) I don't know why it doesn't clean up the test_generators cycle. Maybe it's related to doctest, or the way doctests run.
Logged In: YES user_id=56214 Checked in as of r45235, w/added comment to ceval.c. If the test that's leaking doesn't leave a generator suspended in a 'with', try/except, or try/finally block, then a reference is probably being held somewhere that makes it not garbage yet. (Or perhaps it's being referenced by an object w/a __del__ method?) Let me know what you find out.