summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 10:08:57 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 10:08:57 (GMT)
commitbc6a4db66d576b29462a965e78f4d4a1dce494f0 (patch)
treeabaf631745cbbacb6cc00ca8ccbd196ff41ee7e1 /Modules
parent7098685bdb626c641f0a7adb6375a513e728840c (diff)
downloadcpython-bc6a4db66d576b29462a965e78f4d4a1dce494f0.zip
cpython-bc6a4db66d576b29462a965e78f4d4a1dce494f0.tar.gz
cpython-bc6a4db66d576b29462a965e78f4d4a1dce494f0.tar.bz2
Issue #11393: fault handler uses raise(signum) for SIGILL on Windows
Diffstat (limited to 'Modules')
-rw-r--r--Modules/faulthandler.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 6e3ed7c..5ec94f0 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -270,14 +270,16 @@ faulthandler_fatal_error(
else
_Py_DumpTraceback(fd, tstate);
-#ifndef MS_WINDOWS
- /* call the previous signal handler: it is called if we use sigaction()
- thanks to SA_NODEFER flag, otherwise it is deferred */
- raise(signum);
-#else
- /* on Windows, don't call explictly the previous handler, because Windows
- signal handler would not be called */
+#ifdef MS_WINDOWS
+ if (signum == SIGSEGV) {
+ /* don't call explictly the previous handler for SIGSEGV in this signal
+ handler, because the Windows signal handler would not be called */
+ return;
+ }
#endif
+ /* call the previous signal handler: it is called immediatly if we use
+ sigaction() thanks to SA_NODEFER flag, otherwise it is deferred */
+ raise(signum);
}
/* Install handler for fatal signals (SIGSEGV, SIGFPE, ...). */
@@ -681,8 +683,9 @@ static PyObject *
faulthandler_sigsegv(PyObject *self, PyObject *args)
{
#if defined(MS_WINDOWS)
- /* faulthandler_fatal_error() restores the previous signal handler and then
- gives back the execution flow to the program. In a normal case, the
+ /* For SIGSEGV, faulthandler_fatal_error() restores the previous signal
+ handler and then gives back the execution flow to the program (without
+ calling explicitly the previous error handler). In a normal case, the
SIGSEGV was raised by the kernel because of a fault, and so if the
program retries to execute the same instruction, the fault will be
raised again.
@@ -724,13 +727,7 @@ faulthandler_sigbus(PyObject *self, PyObject *args)
static PyObject *
faulthandler_sigill(PyObject *self, PyObject *args)
{
-#if defined(MS_WINDOWS)
- /* see faulthandler_sigsegv() for the explanation about while(1) */
- while(1)
- raise(SIGILL);
-#else
raise(SIGILL);
-#endif
Py_RETURN_NONE;
}
#endif