[Python-bugs-list] [ python-Bugs-473753 ] Plug sys.exc_info() leaks

noreply@sourceforge.net noreply@sourceforge.net
Mon, 22 Oct 2001 13:52:36 -0700


Bugs item #473753, was opened at 2001-10-22 12:12
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=473753&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim Peters (tim_one)
>Assigned to: Jeremy Hylton (jhylton)
Summary: Plug sys.exc_info() leaks

Initial Comment:
As the Library manual has warned for years, this kind 
of program leaks bigtime:

import sys
def f():
.    try:
.        1 / 0
.    except ZeroDivisionError:
.        err = sys.exc_info()

while 1:
.    f()

because err[-1] is a traceback object, from which f's 
frame can be reached, from which we can get back 
to 'err'.

2.2 added frames to gc (thanks to NeilS), but this 
example still leaks.  That's at best an embarrassing 
trap, and it just popped up again in Zope's testing 
framework.  Best guess is that a cure amounts to 
adding traceback objects to gc too, although I haven't 
tried that so am not sure.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=473753&group_id=5470