[Python-Dev] Exception masking/chaining

Guido van Rossum guido@python.org
Thu, 12 Jun 2003 11:22:39 -0400


> > [...]
> >>I don't understand that. What is a "spurious" traceback? And how
> >>are you going to get one if the current traceback is empty?
> > 
> > I was imagining that the default mechanism for printing tracebacks
> > would always try to follow the chain of tracebacks, and report not
> > just the traceback, but also the exception that was replaced.  There's
> > a lot of C code out there that catches e.g. AttributeError and
> > replaces it with a more specific error (e.g. BifurcationError("can't
> > bifurcate the sploorg") replacing AttributeError("__bifurcate__").
> > I think this would cause end user confusion.
> 
> Isn't the new sys.exc_clear() usable for that? (I.e. raising
> a fresh exception without any chained ones?)

But that's backwards incompatible, in the sense that currently you
don't need to call exc_clear() unless under very special
circumstances.

--Guido van Rossum (home page: http://www.python.org/~guido/)