summaryrefslogtreecommitdiff
path: root/Lib/asyncio/unix_events.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r--Lib/asyncio/unix_events.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 69c719c323..ec767f57d3 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: