[Python-checkins] cpython: faulthandler: fix the handler of user signals

victor.stinner python-checkins at python.org
Thu Aug 9 02:47:42 CEST 2012


http://hg.python.org/cpython/rev/7d821a09a640
changeset:   78470:7d821a09a640
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Aug 09 02:43:41 2012 +0200
summary:
  faulthandler: fix the handler of user signals

Restore the errno before calling the previous signal handler, and not after.

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


diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -659,17 +659,22 @@
 #ifdef HAVE_SIGACTION
     if (user->chain) {
         (void)sigaction(signum, &user->previous, NULL);
+        errno = save_errno;
+
         /* call the previous signal handler */
         raise(signum);
+
+        save_errno = errno;
         (void)faulthandler_register(signum, user->chain, NULL);
+        errno = save_errno;
     }
 #else
     if (user->chain) {
+        errno = save_errno;
         /* call the previous signal handler */
         user->previous(signum);
     }
 #endif
-    errno = save_errno;
 }
 
 static int

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


More information about the Python-checkins mailing list