Message142522
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 |
|
Date |
User |
Action |
Args |
2011-08-20 11:46:37 | pitrou | set | recipients:
+ pitrou, ncoghlan, benjamin.peterson, martin.panter |
2011-08-20 11:46:37 | pitrou | set | messageid: <1313840797.26.0.864938175313.issue12791@psf.upfronthosting.co.za> |
2011-08-20 11:46:36 | pitrou | link | issue12791 messages |
2011-08-20 11:46:36 | pitrou | create | |
|