asyncio: Sync with upstream

This commit is contained in:
Yury Selivanov 2016-11-03 15:35:23 -07:00
parent 491a912659
commit c5420492cf
1 changed files with 3 additions and 0 deletions

View File

@ -348,6 +348,9 @@ class BaseEventLoop(events.AbstractEventLoop):
self._asyncgens.discard(agen) self._asyncgens.discard(agen)
if not self.is_closed(): if not self.is_closed():
self.create_task(agen.aclose()) 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): def _asyncgen_firstiter_hook(self, agen):
if self._asyncgens_shutdown_called: if self._asyncgens_shutdown_called: