[Python-checkins] cpython: faulthandler: save/restore errno in the two signal handlers

victor.stinner python-checkins at python.org
Sat May 7 12:21:39 CEST 2011


http://hg.python.org/cpython/rev/bae531098e68
changeset:   69887:bae531098e68
parent:      69885:2f978b4c02ad
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Sat May 07 12:20:11 2011 +0200
summary:
  faulthandler: save/restore errno in the two signal handlers

files:
  Modules/faulthandler.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -238,6 +238,7 @@
     unsigned int i;
     fault_handler_t *handler = NULL;
     PyThreadState *tstate;
+    int save_errno = errno;
 
     if (!fatal_error.enabled)
         return;
@@ -285,6 +286,7 @@
             _Py_DumpTraceback(fd, tstate);
     }
 
+    errno = save_errno;
 #ifdef MS_WINDOWS
     if (signum == SIGSEGV) {
         /* don't call explictly the previous handler for SIGSEGV in this signal
@@ -593,6 +595,7 @@
 {
     user_signal_t *user;
     PyThreadState *tstate;
+    int save_errno = errno;
 
     user = &user_signals[signum];
     if (!user->enabled)
@@ -614,6 +617,7 @@
             return;
         _Py_DumpTraceback(user->fd, tstate);
     }
+    errno = save_errno;
 }
 
 static int

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


More information about the Python-checkins mailing list