Skip to content

Commit

Permalink
bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter …
Browse files Browse the repository at this point in the history
…shutdown (GH-4956) (#4962)

(cherry picked from commit 4a02543)
  • Loading branch information
miss-islington authored and asvetlov committed Dec 21, 2017
1 parent fdb148f commit 3bc68cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Lib/asyncio/unix_events.py
Expand Up @@ -61,8 +61,14 @@ def _socketpair(self):

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:
Expand Down
@@ -0,0 +1 @@
Don't unsubscribe signals in asyncio UNIX event loop on interpreter shutdown.

0 comments on commit 3bc68cf

Please sign in to comment.