]> granicus.if.org Git - python/commitdiff
Issue #18343: faulthandler.register() now keeps the previous signal handler
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 1 Jul 2013 22:14:56 +0000 (00:14 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 1 Jul 2013 22:14:56 +0000 (00:14 +0200)
when the function is called twice, so faulthandler.unregister() restores
correctly the original signal handler.

Misc/NEWS
Modules/faulthandler.c

index dd6d8d13c7162eaf2c925112685730baddfeaf62..c887f358420de30168ce77bf240802b606e9ef63 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -41,6 +41,10 @@ Core and Builtins
 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
index 7e363f03c94e76d961ecddfc9fb3b65f37beb8a6..c86a27f26e89d9ff15e9379dd5e4cdf38f9ce620 100644 (file)
@@ -742,6 +742,8 @@ faulthandler_register_py(PyObject *self,
             PyErr_SetFromErrno(PyExc_OSError);
             return NULL;
         }
+
+        user->previous = previous;
     }
 
     Py_XDECREF(user->file);
@@ -750,7 +752,6 @@ faulthandler_register_py(PyObject *self,
     user->fd = fd;
     user->all_threads = all_threads;
     user->chain = chain;
-    user->previous = previous;
     user->interp = tstate->interp;
     user->enabled = 1;