From edad4d89e357c92f70c0324b937845d652b20afd Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 25 Sep 2019 03:32:08 -0700 Subject: bpo-38248: Fix inconsistent immediate asyncio.Task cancellation (GH-16330) --- Lib/asyncio/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/asyncio/tasks.py') diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index a0cb884eaca..38d982716d4 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -284,7 +284,7 @@ class Task(futures._PyFuture): # Inherit Python Task implementation if self._must_cancel: # Task is cancelled right before coro stops. self._must_cancel = False - super().set_exception(exceptions.CancelledError()) + super().cancel() else: super().set_result(exc.value) except exceptions.CancelledError: -- cgit v1.2.3