diff --git a/plugins/python-loader/gnm-py-interpreter.c b/plugins/python-loader/gnm-py-interpreter.c
index d42a478..9193672 100644
--- a/plugins/python-loader/gnm-py-interpreter.c
+++ b/plugins/python-loader/gnm-py-interpreter.c
@@ -40,12 +40,21 @@ enum {
 static guint signals[LAST_SIGNAL] = { 0 };
 static GObjectClass *parent_class = NULL;
 
+static int
+cb_test_signals (void)
+{
+	if (PyErr_CheckSignals () < 0)
+		gtk_main_quit ();
+	return TRUE;
+}
+
 static void
 gnm_py_interpreter_init (GnmPyInterpreter *interpreter)
 {
 	interpreter->py_thread_state = NULL;
 	interpreter->stringio_class  = NULL;
 	interpreter->plugin = NULL;
+	g_idle_add ((GSourceFunc) cb_test_signals, interpreter);
 }
 
 static void
@@ -53,6 +62,7 @@ gnm_py_interpreter_finalize (GObject *obj)
 {
 	GnmPyInterpreter *interpreter = GNM_PY_INTERPRETER (obj);
 
+	g_idle_remove_by_data (obj);
 	if (interpreter->stringio_class != NULL) {
 		Py_DECREF (interpreter->stringio_class);
 	}
