Skip to content

Commit

Permalink
Prevent exception spam during interpreter teardown (#24)
Browse files Browse the repository at this point in the history
* Prevent exception spam during interpreter teardown

* Fix pre-commit checks
  • Loading branch information
apmorton authored Jan 2, 2024
1 parent a8f3841 commit 2aad950
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion comm/base_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations

import contextlib
import logging
import typing as t
import uuid
Expand Down Expand Up @@ -81,7 +82,10 @@ def publish_msg(

def __del__(self) -> None:
"""trigger close on gc"""
self.close(deleting=True)
with contextlib.suppress(Exception):
# any number of things can have gone horribly wrong
# when called during interpreter teardown
self.close(deleting=True)

# publishing messages

Expand Down

0 comments on commit 2aad950

Please sign in to comment.