From 8200c66deb0ca001b02bb2a4dd0f1a712d0fe7e5 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Sun, 24 Dec 2017 11:30:14 +0200 Subject: [PATCH] bpo-26133: Clear signals list on interpreter finalizing --- Lib/asyncio/unix_events.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index ec767f57d3aa0f..5d6a3c09ac7c95 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -55,10 +55,13 @@ def close(self): for sig in list(self._signal_handlers): self.remove_signal_handler(sig) else: - warinigs.warn(f"Closing the loop {self!r} on interpreter shutdown " - f"stage, signal unsubsription is disabled", - ResourceWarning, - source=self) + if self._signal_handlers: + warinigs.warn(f"Closing the loop {self!r} " + f"on interpreter shutdown " + f"stage, signal unsubsription is disabled", + ResourceWarning, + source=self) + self._signal_handlers.clear() def _process_self_data(self, data): for signum in data: