From eb824103084d1a8b98041788cfd7bed4afcac245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Fri, 17 Dec 2021 07:25:21 +0100 Subject: [PATCH] Fix signal teardown outside main thread --- pytorch_lightning/trainer/connectors/signal_connector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/trainer/connectors/signal_connector.py b/pytorch_lightning/trainer/connectors/signal_connector.py index daecf5a419a7f..8b3291ecfaa4b 100644 --- a/pytorch_lightning/trainer/connectors/signal_connector.py +++ b/pytorch_lightning/trainer/connectors/signal_connector.py @@ -103,7 +103,7 @@ def teardown(self) -> None: """Restores the signals that were previsouly configured before :class:`SignalConnector` replaced them.""" for signum, handler in self._original_handlers.items(): if handler is not None: - signal.signal(signum, handler) # type: ignore[arg-type] + self._register_signal(signum, handler) self._original_handlers = {} @staticmethod