diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2017-12-21 17:06:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-21 17:06:46 +0200 |
commit | 4a02543cf97e8cbf9293741379f977b85531e4c2 (patch) | |
tree | e066c0d8741a23e492897f55fca6ccea4fa0f20f /Lib/asyncio/unix_events.py | |
parent | e47e698da6bd982da277960c14afa9d9939e3155 (diff) | |
download | cpython-4a02543cf97e8cbf9293741379f977b85531e4c2.tar.gz cpython-4a02543cf97e8cbf9293741379f977b85531e4c2.zip |
bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (#4956)
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 10 |
1 files changed, 8 insertions, 2 deletions
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 @@ 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: |