From c5420492cf367a4224174c5595a4c8a2d059136c Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 3 Nov 2016 15:35:23 -0700 Subject: [PATCH] asyncio: Sync with upstream --- Lib/asyncio/base_events.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index ddf041d4d06..5597bcb7cdb 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -348,6 +348,9 @@ class BaseEventLoop(events.AbstractEventLoop): self._asyncgens.discard(agen) if not self.is_closed(): self.create_task(agen.aclose()) + # Wake up the loop if the finalizer was called from + # a different thread. + self._write_to_self() def _asyncgen_firstiter_hook(self, agen): if self._asyncgens_shutdown_called: