INADA Naoki added the comment:

This behavior is documented as:

https://docs.python.org/3.6/library/asyncio-task.html#asyncio.Task.cancel

> Unlike Future.cancel(), this does not guarantee that the task will be 
> cancelled: the exception might be caught and acted upon, delaying 
> cancellation of the task or preventing cancellation completely. The task may 
> also return a value or raise a different exception.
>
> Immediately after this method is called, cancelled() will not return True 
> (unless the task was already cancelled). A task will be marked as cancelled 
> when the wrapped coroutine terminates with a CancelledError exception (even 
> if cancel() was not called).

I agree that this behavior is somewhat surprising.
But I don't know how can I fix the behavior.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30048>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to