From d80b0153dd2f3d254f82308eca9cc1fbd6f1b56f Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 16 Jul 2003 23:12:02 +0000 Subject: [PATCH] Fix for #764099. Instead of undoing Python's signal handlers and module, just set SIG_DFL for SIGINT. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_extras.py | 9 +++++++++ wxPython/src/gtk/wx.py | 9 +++++++++ wxPython/src/helpers.cpp | 4 ---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 1cc71d3a8b..ce9dcdb12e 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -970,6 +970,15 @@ of your Mac.""" if redirect: self.RedirectStdio(filename) + # Set the default handler for SIGINT. This fixes a problem + # where if Ctrl-C is pressed in the console that started this + # app then it will not appear to do anything, (not even send + # KeyboardInterrupt???) but will later segfault on exit. By + # setting the default handler then the app will exit, as + # expected (depending on platform.) + import signal + signal.signal(signal.SIGINT, signal.SIG_DFL) + # this initializes wxWindows and then calls our OnInit _wxStart(self.OnInit) diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index 0ba09366fd..33526ac813 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -1935,6 +1935,15 @@ of your Mac.""" if redirect: self.RedirectStdio(filename) + # Set the default handler for SIGINT. This fixes a problem + # where if Ctrl-C is pressed in the console that started this + # app then it will not appear to do anything, (not even send + # KeyboardInterrupt???) but will later segfault on exit. By + # setting the default handler then the app will exit, as + # expected (depending on platform.) + import signal + signal.signal(signal.SIGINT, signal.SIG_DFL) + # this initializes wxWindows and then calls our OnInit _wxStart(self.OnInit) diff --git a/wxPython/src/helpers.cpp b/wxPython/src/helpers.cpp index 3cf9d3e290..081932b248 100644 --- a/wxPython/src/helpers.cpp +++ b/wxPython/src/helpers.cpp @@ -386,10 +386,6 @@ void __wxPreStart(PyObject* moduleDict) wxPyTMutex = new wxMutex; #endif - // Restore default signal handlers, (prevents crash upon Ctrl-C in the - // console that launched a wxPython app...) - PyOS_FiniInterrupts(); - wxApp::CheckBuildOptions(wxBuildOptions()); wxPyAssertionError = PyErr_NewException("wxPython.wxc.wxPyAssertionError",