]> granicus.if.org Git - python/commitdiff
bpo-26133: Clear signals list on interpreter finalizing (GH-5002) (#5003)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 24 Dec 2017 12:30:57 +0000 (04:30 -0800)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Sun, 24 Dec 2017 12:30:57 +0000 (14:30 +0200)
(cherry picked from commit 4f146f9ed133b9ad56d4ee7a653396836af34067)

Lib/asyncio/unix_events.py

index dde1d3588f220451e14ae3599e1a638bedc0aa0e..70b7050d9b77aefe9f3311b5eb383759faf7e437 100644 (file)
@@ -65,10 +65,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: