[IPython-dev] Re: IPython Crash Report

Fernando Perez fperez at colorado.edu
Tue May 13 15:13:27 EDT 2003

Hi Gary,

> The idea is simple. I assume that during the exec in 
> InteractiveShell.runcode, calls to sys.excepthook are just another normal
> exception rather than a crash in IPython. I do this by swapping in a local
> excepthook just before the exec and swapping it back out just after. I
> added 3 methods to InteractiveShell: excepthook (the local handler),
> setexcepthook (to swap it in) and clearexcepthook (to swap it out).

Great, thanks for your effort.  Right now I'm busy with 'real' work, so I
won't have time to look at this in detail.  Maybe tonight or tomorrow.  But
please keep using it with your own stuff and see if it breaks anything.  I'll
study it in detail, and if all looks ok, I'll commit the patches.  I have to
think hard about possible corner cases.

> I also modified AutoFormattedTB to 1) respect etype,value, and tb args if
> they are given, and 2) to accept an offset argument to temporarily override
> the tb_offset. There is probably a better way to accomplish this...

This actually sounds ok.  The beauty of python's optional arguments is that
one can tweak functions for corner cases without breaking their 'main' 
functionality.  And it's necessary to have fine control over stack frame 
offsets, b/c of the need to properly 'hit' the right user frame through 
ipython's own code.

Let's keep in touch on this.



ps.  I'm cc-ing the list on my replies to keep this stuff archived/searchable. 
  I'm going to switch to cc-ing the dev list, as this became far more 
technical than most user issues.

More information about the IPython-dev mailing list