summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-10-21 21:13:40 (GMT)
committerYury Selivanov <yury@magic.io>2016-10-21 21:13:40 (GMT)
commited0540698ef2ea66dfd662ac6e98a15e8eabf365 (patch)
tree95b2ebb9782da72ffa6a72e73c22744d820fcb36 /Lib/asyncio
parent68adfa3b3e59a6b0162ae4fb375c0ce987e51174 (diff)
downloadcpython-ed0540698ef2ea66dfd662ac6e98a15e8eabf365.zip
cpython-ed0540698ef2ea66dfd662ac6e98a15e8eabf365.tar.gz
cpython-ed0540698ef2ea66dfd662ac6e98a15e8eabf365.tar.bz2
Issue #28500: Fix asyncio to handle async gens GC from another thread.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/base_events.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 5b5fcde..e59b2b7 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: