In any case, we have a general issue: The IPython crash handler should only be catching errors in IPython code. That means that when we hook up to an eventloop, we have to disable the crash handler immediately, and add enabling/disabling the crash handler as part of the callback we inject to the loop, so it is only active during IPython execution.

But on the more general issue, I completely agree with you, the crash handler needs to get out of the way when event loops are there.

I'm actually inclined to go forward, and consider disabling the crash handler by default, and instead add a magic that turns it manually on. If people come to us with normal tracebacks that we can't debug and their crash is reproducible, we can tell them to type

%crash_handler on

and then to mail us the output.

I wrote that crash handler code early in ipython's life, when there was zero test suite and basically every problem I fixed was via crashes reported by users, so having this information was extremely useful. But in recent years, with increasingly solid test suite coverage (not perfect, but certainly decent), it seems like the CH is actually causing us more headaches than solutions. What do you think?

I'm inclined to agree. Do we want to still override excepthook with something that mentions how to report issues or turn on the verbose handler, but without the big crash message, and massive traceback?

e.g.

-------------------------
regular traceback
...
Exception : msg
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to ipython-dev@scipy.org
You can enable a much more verbose traceback with `%crash_handler on`.

Actually I'm closing this: it's just a bad call to matplotlib that only triggers in the event loop. The user did make an error, there's nothing we can do other than printing the traceback. The fact that the traceback looks different is an indicator that it came from somewhere outside of the normal execution. Users can still use %tb to get a detailed traceback and %debug also works, so I don't see what else we need to do here.