You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
keyboardinterrupt crashes gtk gui when gtk.set_interactive is not available #825
older gtk versions do not have gtk.set_interactive available which causes ipython to "use our own ctypes version":
IPython/lib/inputhook.py
240 import gtk
241 try:
242 gtk.set_interactive(True)
243 self._current_gui = GUI_GTK
244 except AttributeError:
245 # For older versions of gtk, use our own ctypes version
246 from IPython.lib.inputhookgtk import inputhook_gtk
247 self.set_inputhook(inputhook_gtk)
248 self._current_gui = GUI_GTK
this alternative does not handle keyboard interrupts well:
# make ipython use alternative, e.g. by using old gtk version or by editing:
# sed -i -e "s/gtk.set_interactive/gtk.garrbage/" IPython/lib/inputhook.py
ipython --pylab="gtk"
IN[1]: ^C
KeyboardInterrupt Python 2.7.2+: /home/jtaylor/chroots/python/bin/python
Thu Sep 29 23:56:04 2011
A problem occured executing Python code. Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/home/jtaylor/chroots/python/_ctypes/callbacks.c in 'calling callback function'()
/home/jtaylor/chroots/python/lib/python2.7/site-packages/IPython/lib/inputhookgtk.pyc in inputhook_gtk()
18
19 import sys
20 import gtk, gobject
21
22 #-----------------------------------------------------------------------------
23 # Code
24 #-----------------------------------------------------------------------------
25
26
27 def _main_quit(*args, **kwargs):
28 gtk.main_quit()
29 return False
30
31 def inputhook_gtk():
32 gobject.io_add_watch(sys.stdin, gobject.IO_IN, _main_quit)
---> 33 gtk.main()
34 return 0
35
KeyboardInterrupt:
**********************************************************************
Oops, ipython crashed. We do our best to make it stable, but...
The "Oops, ipython crashed." seen above most certainly expands to:
...
Original exception was:
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 313, in 'calling callback function'
...
i.e. one can't raise (or let go through) an exception from a ctypes callback, inputhook_gtk here.
So at a minimum, a try: ... except KeyboardInterrupt: pass should be added there.
@juliantaylor, since you're the only one to be able to test any fixes for this (I don't have a machine with a pygtk old enough to see it), we'll have to wait on you for a fix. You could try the try/except solution suggested above by @cboos; if it works for you go ahead and submit a PR for this. As long as it doesn't cause any problems with newer pygtks, we'll be happy to include the fix.
I'm retargetting for 0.13, b/c we're basically at the point of releasing 0.12 and I only want to focus on critical issues that absolutely must go in before release, this doesn't quite meet that threshold.
the crash was fixed with 0fc80df
that ctrl+c does not work at all like before is probably a different issue (or intentional change ?) as it affects also other backends on more up to date systems.
We got distracted by #1157, but it sounds like this can be closed. Is that right @juliantaylor? I have no way of reproducing this, and you said you weren't seeing it either. In the interest of expedient triage I'm closing it now, please ping for a reopen if you find evidence it's still an issue.
Activity
minrk commentedon Sep 29, 2011
Sometimes we need to double-catch interrupts with these gui event loops.
How did you encounter this? PyGTK 2.15.0 (I believe the first to include set_interactive) was released in 05/2009, which is rather old.
juliantaylor commentedon Sep 30, 2011
Most still supported distributions should have newer versions, but unfortunately I currently have to use a fedora 11 machine which has pygtk 2.14 :(
cboos commentedon Oct 9, 2011
The "Oops, ipython crashed." seen above most certainly expands to:
i.e. one can't raise (or let go through) an exception from a ctypes callback,
inputhook_gtkhere.So at a minimum, a
try: ... except KeyboardInterrupt: passshould be added there.fperez commentedon Dec 13, 2011
@juliantaylor, since you're the only one to be able to test any fixes for this (I don't have a machine with a pygtk old enough to see it), we'll have to wait on you for a fix. You could try the
try/exceptsolution suggested above by @cboos; if it works for you go ahead and submit a PR for this. As long as it doesn't cause any problems with newer pygtks, we'll be happy to include the fix.I'm retargetting for 0.13, b/c we're basically at the point of releasing 0.12 and I only want to focus on critical issues that absolutely must go in before release, this doesn't quite meet that threshold.
juliantaylor commentedon Dec 15, 2011
has this issue been fixed in HEAD? I can't reproduce it anymore, but ctrl+c also does not work at all anymore
juliantaylor commentedon Dec 15, 2011
the crash was fixed with 0fc80df
that ctrl+c does not work at all like before is probably a different issue (or intentional change ?) as it affects also other backends on more up to date systems.
fperez commentedon Dec 15, 2011
Wow, since when did Ctrl-C stop working??? That's a huge regression, and most certainly a blocker. I'll open a separate issue for that.
fperez commentedon Jun 26, 2012
We got distracted by #1157, but it sounds like this can be closed. Is that right @juliantaylor? I have no way of reproducing this, and you said you weren't seeing it either. In the interest of expedient triage I'm closing it now, please ping for a reopen if you find evidence it's still an issue.