Exception hook should be optional for embedding IPython in GUIs

Bug #337105 reported by Gael Varoquaux
2
Affects Status Importance Assigned to Milestone
IPython
Triaged
High
Unassigned

Bug Description

When embbeding IPython, the exception hook (IPython crashed.... ) captures exception that are not IPython exceptions. It can be desirable not to capture any exceptions and to let the application designer deal with the exceptions.

As such, it would be nice if the main exception hook could be disabled by a switch on the IPython0 instance.

Revision history for this message
Ville M. Vainio (villemvainio) wrote : Re: [Bug 337105] [NEW] Exception hook should be optional for embedding IPython in GUIs

On Tue, Mar 3, 2009 at 10:19 AM, Gael Varoquaux
<email address hidden> wrote:
> Public bug reported:
>
> When embbeding IPython, the exception hook (IPython crashed.... )
> captures exception that are not IPython exceptions. It can be desirable
> not to capture any exceptions and to let the application designer deal
> with the exceptions.
>
> As such, it would be nice if the main exception hook could be disabled
> by a switch on the IPython0 instance.

I accomplish this in qt ui by:

# cruel hack to avoid subclassing and prevent crash handler
IPython.iplib.InteractiveShell.isThreaded = True

--
Ville M. Vainio
http://tinyurl.com/vainio

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 337105] [NEW] Exception hook should be optional for embedding IPython in GUIs

On Tue, Mar 03, 2009 at 08:28:03AM -0000, Ville M. Vainio wrote:
> On Tue, Mar 3, 2009 at 10:19 AM, Gael Varoquaux
> <email address hidden> wrote:
> > Public bug reported:

> > When embbeding IPython, the exception hook (IPython crashed.... )
> > captures exception that are not IPython exceptions. It can be desirable
> > not to capture any exceptions and to let the application designer deal
> > with the exceptions.

> > As such, it would be nice if the main exception hook could be disabled
> > by a switch on the IPython0 instance.

> I accomplish this in qt ui by:

> # cruel hack to avoid subclassing and prevent crash handler
> IPython.iplib.InteractiveShell.isThreaded = True

OK, that will do the trick. I believe we can close this bug report.

Thanks,

Gaël

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Closing as won't fix since the solution is more of a workaround. As we refactor things, we can offer later a nicer way to do this. But I'm happy to close for now.

Changed in ipython:
status: New → Won't Fix
Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 337105] Re: Exception hook should be optional for embedding IPython in GUIs

On Sat, Mar 14, 2009 at 12:52:18PM -0000, Fernando Perez wrote:
> Closing as won't fix since the solution is more of a workaround. As we
> refactor things, we can offer later a nicer way to do this. But I'm
> happy to close for now.

> ** Changed in: ipython
> Status: New => Won't Fix

I have just implemented this in the Enthought codebase (will move it up
to the frontend code in IPython soon).

This is simply _horrible_: module-level monkey patching. In other words:
huge side effects. I don't think this solution is acceptabe, and I'd like
this bug reopened, admitedly with a milestone set for later than 0.10.

The IPython-related code in ETS is full of similar hacks (like
monkey-patching raw_input). It renders the whole applications fragiles.

Gaël

Revision history for this message
Ville M. Vainio (villemvainio) wrote : Re: [Bug 337105] Re: Exception hook should be optional for embedding IPython in GUIs

On Sun, Mar 15, 2009 at 2:27 PM, Gael Varoquaux
<email address hidden> wrote:

> This is simply _horrible_: module-level monkey patching. In other words:
> huge side effects. I don't think this solution is acceptabe, and I'd like
> this bug reopened, admitedly with a milestone set for later than 0.10.

I agree that it's horrible. A proper solution would be to implement
the crash handler as a hook (and have current crash handler as the
default handler if hook raises TryNext).

--
Ville M. Vainio
http://tinyurl.com/vainio

Revision history for this message
Gael Varoquaux (gael-varoquaux) wrote : Re: [Bug 337105] Re: Exception hook should be optional for embedding IPython in GUIs

On Sun, Mar 15, 2009 at 12:42:19PM -0000, Ville M. Vainio wrote:
> On Sun, Mar 15, 2009 at 2:27 PM, Gael Varoquaux
> <email address hidden> wrote:

> > This is simply _horrible_: module-level monkey patching. In other words:
> > huge side effects. I don't think this solution is acceptabe, and I'd like
> > this bug reopened, admitedly with a milestone set for later than 0.10.

> I agree that it's horrible. A proper solution would be to implement
> the crash handler as a hook (and have current crash handler as the
> default handler if hook raises TryNext).

That sounds good.

Gaël

Revision history for this message
Fernando Perez (fdo.perez) wrote :

Reopened as per feedback in thread. We'll look into it post-0.10 though.

Changed in ipython:
importance: Undecided → High
status: Won't Fix → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.