[Python-checkins] bpo-26133: Clear signals list on interpreter finalizing (GH-5002) (#5003)

Andrew Svetlov webhook-mailer at python.org
Sun Dec 24 07:31:01 EST 2017


https://github.com/python/cpython/commit/5ff5d1167de88eb37265dcaf1396d12617a0ace7
commit: 5ff5d1167de88eb37265dcaf1396d12617a0ace7
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Andrew Svetlov <andrew.svetlov at gmail.com>
date: 2017-12-24T14:30:57+02:00
summary:

bpo-26133: Clear signals list on interpreter finalizing (GH-5002) (#5003)

(cherry picked from commit 4f146f9ed133b9ad56d4ee7a653396836af34067)

files:
M Lib/asyncio/unix_events.py

diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index dde1d3588f2..70b7050d9b7 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -65,10 +65,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:



More information about the Python-checkins mailing list