]> granicus.if.org Git - python/commitdiff
faulthandler: improve_sigabrt() on Visual Studio
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 9 May 2011 23:30:03 +0000 (01:30 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 9 May 2011 23:30:03 +0000 (01:30 +0200)
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.

Modules/faulthandler.c

index 6cf06ad2420f3525fd54555dfa8ec6671ab7ea54..3549af5367b9f2fab6105cf5b9302a3b5a14a2ac 100644 (file)
@@ -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;
 }