From: Yury Selivanov Date: Fri, 21 Oct 2016 21:13:40 +0000 (-0400) Subject: Issue #28500: Fix asyncio to handle async gens GC from another thread. X-Git-Tag: v3.6.0b3~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed0540698ef2ea66dfd662ac6e98a15e8eabf365;p=thirdparty%2FPython%2Fcpython.git Issue #28500: Fix asyncio to handle async gens GC from another thread. --- diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 5b5fcde4388c..e59b2b75ac14 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -351,6 +351,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: diff --git a/Misc/NEWS b/Misc/NEWS index 4410edadf9a5..e508fc15598b 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,8 @@ Library - Issue #28492: Fix how StopIteration exception is raised in _asyncio.Future. +- Issue #28500: Fix asyncio to handle async gens GC from another thread. + Build -----