Skip to content

Commit

Permalink
Prevent possible exception in tornado.concurrent.Future._set_done
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhestkov committed Mar 21, 2024
1 parent 5710bc3 commit 52df007
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions salt/ext/tornado/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,13 @@ def _check_done(self):

def _set_done(self):
self._done = True
for cb in self._callbacks:
try:
cb(self)
except Exception:
app_log.exception("Exception in callback %r for %r", cb, self)
self._callbacks = None
if self._callbacks:
for cb in self._callbacks:
try:
cb(self)
except Exception:
app_log.exception("Exception in callback %r for %r", cb, self)
self._callbacks = None

# On Python 3.3 or older, objects with a destructor part of a reference
# cycle are never destroyed. It's no longer the case on Python 3.4 thanks to
Expand Down

0 comments on commit 52df007

Please sign in to comment.