[Python-3000] The future of exceptions

Jim Jewett jimjjewett at gmail.com
Mon Sep 4 02:57:35 CEST 2006


On 9/3/06, Brett Cannon <brett at python.org> wrote:
> On 9/3/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> > The traceback gets created anyway, so how
> > is it going to use more memory if it's attached to a
> > throwaway exception instead of kept in a sys variable?

> > ...  how often are exceptions kept for long
> > periods after being caught?

> It was a sticking point when the idea was first put forth.

I think people were really objecting to cyclic garbage in general.
Both the garbage collector and weak references have improved since the
original discussion.

Even today, if a StopIteration() participates in a reference cycle,
then it won't be reclaimed until the next gc run.  I'm not quite sure
which direction should be a weakref, but I think it would be
reasonable for the cycle to get broken when an catching except block
exits without reraising.

-jJ


More information about the Python-3000 mailing list