Skip to content

Commit 2aad950

Browse files
authored
Prevent exception spam during interpreter teardown (#24)
* Prevent exception spam during interpreter teardown * Fix pre-commit checks
1 parent a8f3841 commit 2aad950

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

comm/base_comm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Distributed under the terms of the Modified BSD License.
66
from __future__ import annotations
77

8+
import contextlib
89
import logging
910
import typing as t
1011
import uuid
@@ -81,7 +82,10 @@ def publish_msg(
8182

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

8690
# publishing messages
8791

0 commit comments

Comments
 (0)