aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Nugent <nugend@gmail.com>2015-02-04 12:59:28 -0500
committerDaniel Nugent <nugend@gmail.com>2015-02-04 12:59:28 -0500
commit803297e41ca76451bc235892a31c48f5289650f8 (patch)
treea5b45496be1c9ea4730b07af11c3ce3e4381a018
parente880269a6fdcacdb961cbaa680f22e9484252036 (diff)
downloadtimeout-decorator-803297e41ca76451bc235892a31c48f5289650f8.tar.gz
Unset alarm before removing SIGALRM handler
In situations where an exception is thrown, the alarm wouldn't be unset even if the handler was removed. This results in program termination.
-rw-r--r--timeout_decorator/timeout_decorator.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/timeout_decorator/timeout_decorator.py b/timeout_decorator/timeout_decorator.py
index 00c3579..f4bb024 100644
--- a/timeout_decorator/timeout_decorator.py
+++ b/timeout_decorator/timeout_decorator.py
@@ -45,8 +45,8 @@ def timeout(seconds=None):
try:
result = f(*args, **kwargs)
finally:
+ signal.alarm(0)
signal.signal(signal.SIGALRM, old)
- signal.alarm(0)
return result
return new_f
return decorate