[Python-checkins] cpython (3.3): Issue #18343: faulthandler.register() now keeps the previous signal handler

victor.stinner python-checkins at python.org
Tue Jul 2 00:17:42 CEST 2013


http://hg.python.org/cpython/rev/229dde749ed6
changeset:   84420:229dde749ed6
branch:      3.3
parent:      84418:ff30bf84b378
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 02 00:14:56 2013 +0200
summary:
  Issue #18343: faulthandler.register() now keeps the previous signal handler
when the function is called twice, so faulthandler.unregister() restores
correctly the original signal handler.

files:
  Misc/NEWS              |  4 ++++
  Modules/faulthandler.c |  3 ++-
  2 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -41,6 +41,10 @@
 Library
 -------
 
+- Issue #18343: faulthandler.register() now keeps the previous signal handler
+  when the function is called twice, so faulthandler.unregister() restores
+  correctly the original signal handler.
+
 - Issue #17097: Make multiprocessing ignore EINTR.
 
 - Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -742,6 +742,8 @@
             PyErr_SetFromErrno(PyExc_OSError);
             return NULL;
         }
+
+        user->previous = previous;
     }
 
     Py_XDECREF(user->file);
@@ -750,7 +752,6 @@
     user->fd = fd;
     user->all_threads = all_threads;
     user->chain = chain;
-    user->previous = previous;
     user->interp = tstate->interp;
     user->enabled = 1;
 

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


More information about the Python-checkins mailing list