Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d37954

Browse files
committed
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.
1 parent b9dbc7d commit 8d37954

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Core and Builtins
4141
Library
4242
-------
4343

44+
- Issue #18343: faulthandler.register() now keeps the previous signal handler
45+
when the function is called twice, so faulthandler.unregister() restores
46+
correctly the original signal handler.
47+
4448
- Issue #17097: Make multiprocessing ignore EINTR.
4549

4650
- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a

Modules/faulthandler.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ faulthandler_register_py(PyObject *self,
742742
PyErr_SetFromErrno(PyExc_OSError);
743743
return NULL;
744744
}
745+
746+
user->previous = previous;
745747
}
746748

747749
Py_XDECREF(user->file);
@@ -750,7 +752,6 @@ faulthandler_register_py(PyObject *self,
750752
user->fd = fd;
751753
user->all_threads = all_threads;
752754
user->chain = chain;
753-
user->previous = previous;
754755
user->interp = tstate->interp;
755756
user->enabled = 1;
756757

0 commit comments

Comments
 (0)