bpo-38248: Fix inconsistent immediate asyncio.Task cancellation (GH-16330)

This commit is contained in:
Yury Selivanov 2019-09-25 03:32:08 -07:00 committed by Carol Willing
parent c64af8fad3
commit edad4d89e3
4 changed files with 14 additions and 8 deletions

View file

@ -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: