[IPython-dev] Clearing exception info stored for %debug?
Tue Jun 3 20:03:46 CDT 2008
2008/1/18 Hans Meine <email@example.com>:
> I just suffered from a complicated situation; I had a file being clobbered on
> IPython quit by a __del__ method from one of the objects in the stack within
> an exception that occurred earlier. After the exception, I only ran one
> corrected command which stored the right file after a long computation, but
> when I quit IPython the data was overwritten by the partial results from the
> earlier, broken run.
> This situation is probably a rare one, but I thought that one might want to
> introduce "%clear exception" or sth. along that lines.
Could you be more specific on how such clearing would be implemented?
As far as I know, Python doesn't provide an official API for exception
clearing, but I could well be wrong. sys holds certain special
In : sys.last
sys.last_traceback sys.last_type sys.last_value
that only appear after an exception has occurred. One could
concievably delete those straight from the sys module dict, but that
feels a bit harsh. And in addition, references could be held
elsewhere, there's no easy way in python for finding all references
held to an object (or is there?). So I'm not opposed in principle to
your idea, I'm just not quite sure how to go about it...
More information about the IPython-dev