]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #28500: Fix asyncio to handle async gens GC from another thread.
authorYury Selivanov <yury@magic.io>
Fri, 21 Oct 2016 21:13:40 +0000 (17:13 -0400)
committerYury Selivanov <yury@magic.io>
Fri, 21 Oct 2016 21:13:40 +0000 (17:13 -0400)
Lib/asyncio/base_events.py
Misc/NEWS

index 5b5fcde4388cbc758c1f5b860daf47126cd58f1a..e59b2b75ac145d5249bea6f3f13c963c02e7614e 100644 (file)
@@ -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:
index 4410edadf9a5306d742a96e54e09c123d53f3a96..e508fc15598b0126f30c89c26498c3efe817f176 100644 (file)
--- 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
 -----