summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 10:56:17 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 10:56:17 (GMT)
commita01ca12a524b608dfa9a3ac3131f4f5be96fa860 (patch)
treee35b73a84da0c5929297c50936dcd9e6834061ba /Modules/faulthandler.c
parentd727e23243ab5479b03aab1f924ca7ec0bccbcb6 (diff)
downloadcpython-a01ca12a524b608dfa9a3ac3131f4f5be96fa860.zip
cpython-a01ca12a524b608dfa9a3ac3131f4f5be96fa860.tar.gz
cpython-a01ca12a524b608dfa9a3ac3131f4f5be96fa860.tar.bz2
Issue #11393: Fix faulthandler.disable() and add a test
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index abff79e..2e3a5b8 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -628,7 +628,7 @@ faulthandler_register(PyObject *self,
static int
faulthandler_unregister(user_signal_t *user, int signum)
{
- if (user->enabled)
+ if (!user->enabled)
return 0;
user->enabled = 0;
#ifdef HAVE_SIGACTION
@@ -976,7 +976,7 @@ int _PyFaulthandler_Init(void)
void _PyFaulthandler_Fini(void)
{
#ifdef FAULTHANDLER_USER
- unsigned int i;
+ unsigned int signum;
#endif
#ifdef FAULTHANDLER_LATER
@@ -995,8 +995,8 @@ void _PyFaulthandler_Fini(void)
#ifdef FAULTHANDLER_USER
/* user */
if (user_signals != NULL) {
- for (i=0; i < NSIG; i++)
- faulthandler_unregister(&user_signals[i], i+1);
+ for (signum=0; signum < NSIG; signum++)
+ faulthandler_unregister(&user_signals[signum], signum);
free(user_signals);
user_signals = NULL;
}