summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-12-21 17:42:32 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2017-12-21 17:42:32 (GMT)
commit3bc68cff5b821e83ee5df8b8cd13f4f54151b406 (patch)
tree5b0568ae95d989c3a0b40ea96e335be8b70ce55e
parentfdb148f949e3ae66036b75163ff68042d19cf0fc (diff)
downloadcpython-3bc68cff5b821e83ee5df8b8cd13f4f54151b406.zip
cpython-3bc68cff5b821e83ee5df8b8cd13f4f54151b406.tar.gz
cpython-3bc68cff5b821e83ee5df8b8cd13f4f54151b406.tar.bz2
bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (GH-4956) (#4962)
(cherry picked from commit 4a02543cf97e8cbf9293741379f977b85531e4c2)
-rw-r--r--Lib/asyncio/unix_events.py10
-rw-r--r--Misc/NEWS.d/next/Library/2017-12-21-11-08-42.bpo-26133.mt81QV.rst1
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 5ea6c20..dde1d35 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -61,8 +61,14 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
def close(self):
super().close()
- for sig in list(self._signal_handlers):
- self.remove_signal_handler(sig)
+ if not sys.is_finalizing():
+ 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)
def _process_self_data(self, data):
for signum in data:
diff --git a/Misc/NEWS.d/next/Library/2017-12-21-11-08-42.bpo-26133.mt81QV.rst b/Misc/NEWS.d/next/Library/2017-12-21-11-08-42.bpo-26133.mt81QV.rst
new file mode 100644
index 0000000..0653d19
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-12-21-11-08-42.bpo-26133.mt81QV.rst
@@ -0,0 +1 @@
+Don't unsubscribe signals in asyncio UNIX event loop on interpreter shutdown.