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

This commit is contained in:
Andrew Svetlov 2017-12-21 17:06:46 +02:00 committed by GitHub
parent e47e698da6
commit 4a02543cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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:

View File

@ -0,0 +1 @@
Don't unsubscribe signals in asyncio UNIX event loop on interpreter shutdown.