ipython/ipython — pull request #1742 by takluyver (2012-05-16 12:08:31+00:00)
Title: Check for custom_exceptions only once

As [reported on the mailing list](http://permalink.gmane.org/gmane.comp.python.ipython.devel/8027), setting a custom exception handler which does something before displaying the default traceback leads to unexpected recursion.

We already catch custom exceptions in `run_code` and call the custom handler, but we were checking for them again in `showtraceback`. This just removes the second check, so custom exception handlers can safely call showtraceback().

This is a slight API change - previously, calling showtraceback would dispatch the custom exception handler if the exception type exactly matched one of those specified (not a subclass). Now it will ignore custom exception handlers. However, I think this change is more intuitive (Min's example code on the mailing list assumed it would work this way), and the use case is reasonable.

I'll look at adding a test for this later.