From 6fe7d7cb41b7027aaaa227974d770640eecdbb7d Mon Sep 17 00:00:00 2001 From: Vinay Sharma Date: Fri, 16 Aug 2019 12:45:36 +0530 Subject: [PATCH] bpo-37703: add arg to cancel all children in gather.cancel() --- Lib/asyncio/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index cd4832cfee..d38349e9ed 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -692,8 +692,8 @@ class _GatheringFuture(futures.Future): self._children = children self._cancel_requested = False - def cancel(self): - if self.done(): + def cancel(self, force_children=False): + if self.done() and not force_children: return False ret = False for child in self._children: -- 2.20.1 (Apple Git-117)