diff options
| author | 2019-09-02 15:49:55 +0100 | |
|---|---|---|
| committer | 2019-09-02 15:50:12 +0100 | |
| commit | d42d694e642180a893a70df9c016ca5e6466fc54 (patch) | |
| tree | 47d29536194b6180b55a373d3823d0d9b3016a28 /src/utils | |
| parent | actually prune non-loadable modules before doing dependency checks (diff) | |
| signature | ||
move deadline alarm time check inside try/finally
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index cabfff31..a5a2ac1f 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -364,12 +364,12 @@ def deadline(seconds: int=10): lambda _1, _2: _raise_deadline()) old_seconds, _ = signal.setitimer(signal.ITIMER_REAL, seconds, 0) - if not old_seconds == 0.0 and seconds > old_seconds: - raise ValueError( - "Deadline timeout larger than parent deadline (%s > %s)" % - (seconds, old_seconds)) - try: + if not old_seconds == 0.0 and seconds > old_seconds: + raise ValueError( + "Deadline timeout larger than parent deadline (%s > %s)" % + (seconds, old_seconds)) + yield finally: signal.signal(signal.SIGALRM, old_handler) |
