summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-09 23:30:03 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-09 23:30:03 (GMT)
commit00bc6ccb786aa2976cc6c405738247359539854c (patch)
tree5af3012309c22efa2699acf53910f3f9f02780a4
parent660e62cd75a5842dee7a115eb74f5b68fd3cf61f (diff)
downloadcpython-00bc6ccb786aa2976cc6c405738247359539854c.zip
cpython-00bc6ccb786aa2976cc6c405738247359539854c.tar.gz
cpython-00bc6ccb786aa2976cc6c405738247359539854c.tar.bz2
faulthandler: improve_sigabrt() on Visual Studio
Use _set_abort_behavior() + abort() instead of raise(SIGABRT) which may write an error message and/or open a popup asking to report the fault.
-rw-r--r--Modules/faulthandler.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 6cf06ad..3549af5 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -816,14 +816,12 @@ faulthandler_sigfpe(PyObject *self, PyObject *args)
static PyObject *
faulthandler_sigabrt(PyObject *self, PyObject *args)
{
-#if _MSC_VER
- /* If Python is compiled in debug mode with Visual Studio, abort() opens
- a popup asking the user how to handle the assertion. Use raise(SIGABRT)
- instead. */
- raise(SIGABRT);
-#else
- abort();
+#ifdef _MSC_VER
+ /* Visual Studio: configure abort() to not display an error message nor
+ open a popup asking to report the fault. */
+ _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
+ abort();
Py_RETURN_NONE;
}