[Python-checkins] cpython: faulthandler: improve_sigabrt() on Visual Studio

victor.stinner python-checkins at python.org
Tue May 10 01:30:10 CEST 2011


http://hg.python.org/cpython/rev/0b8c7cf25d10
changeset:   70000:0b8c7cf25d10
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Tue May 10 01:30:03 2011 +0200
summary:
  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.

files:
  Modules/faulthandler.c |  12 +++++-------
  1 files changed, 5 insertions(+), 7 deletions(-)


diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -816,14 +816,12 @@
 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
+#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();
-#endif
     Py_RETURN_NONE;
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list