[Python-checkins] bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (#4956)

Andrew Svetlov webhook-mailer at python.org
Thu Dec 21 10:06:49 EST 2017


https://github.com/python/cpython/commit/4a02543cf97e8cbf9293741379f977b85531e4c2
commit: 4a02543cf97e8cbf9293741379f977b85531e4c2
branch: master
author: Andrew Svetlov <andrew.svetlov at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017年12月21日T17:06:46+02:00
summary:
bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (#4956)
files:
A Misc/NEWS.d/next/Library/2017-12-21-11-08-42.bpo-26133.mt81QV.rst
M Lib/asyncio/unix_events.py
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 69c719c3239..ec767f57d3a 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -51,8 +51,14 @@ def __init__(self, selector=None):
 
 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 00000000000..0653d1960e5
--- /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.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /