]> granicus.if.org Git - python/commitdiff
bpo-26133: Clear signals list on interpreter finalizing (#5002)
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Sun, 24 Dec 2017 11:50:03 +0000 (13:50 +0200)
committerGitHub <noreply@github.com>
Sun, 24 Dec 2017 11:50:03 +0000 (13:50 +0200)
Lib/asyncio/unix_events.py

index ec767f57d3aa0fd365be51146185273b34143236..5d6a3c09ac7c95ea912f281ce71621153b14927a 100644 (file)
@@ -55,10 +55,13 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
             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: