This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients benjamin.peterson, martin.panter, ncoghlan, pitrou
Date 2011-08-20.11:46:36
SpamBayes Score 2.6625452e-07
Marked as misclassified No
Message-id <1313840797.26.0.864938175313.issue12791@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is probably that the frame keeps the last execution state around, and since the exception itself has a reference to a frame, a cycle is created. Note that it doesn't happen if you catch the GeneratorExit that gets raised inside the generator at shutdown:

def leaky_generator():
    try:   
        1/0
    except:  # Exception handler with anonymous exception variable
        try:
            yield  # Yield from exception handler
        except (GeneratorExit, RuntimeError):
            pass

def throw_leaks(g):
    try:
        g.throw(RuntimeError())
    except Exception:
        pass
History
Date User Action Args
2011-08-20 11:46:37pitrousetrecipients: + pitrou, ncoghlan, benjamin.peterson, martin.panter
2011-08-20 11:46:37pitrousetmessageid: <1313840797.26.0.864938175313.issue12791@psf.upfronthosting.co.za>
2011-08-20 11:46:36pitroulinkissue12791 messages
2011-08-20 11:46:36pitroucreate