Skip to content

Commit

Permalink
Do not reuse exception variable
Browse files Browse the repository at this point in the history
Because:
- The info variable is cleared by Python 3 when exiting the exception
  handler, as it would cause a reference cycle otherwise (Exception
  objects contain tracebacks in them in Python 3).

Fixes #2065
  • Loading branch information
lunkwill42 committed Dec 18, 2019
1 parent 35df3e8 commit 8c79161
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/nav/statemon/abstractchecker.py
Expand Up @@ -187,9 +187,9 @@ def execute_test(self):
start = time.time()
try:
status, info = self.execute()
except Exception as info: # pylint: disable=broad-except
except Exception as error: # pylint: disable=broad-except
status = event.Event.DOWN
info = str(info)
info = str(error)
self.response_time = time.time()-start
return status, info

Expand Down

0 comments on commit 8c79161

Please sign in to comment.