Andrew Svetlov <andrew.svet...@gmail.com> added the comment:

This is a very interesting question.
In asyncio, task cancellation is not executed on `task.cancel()` call 
immediately but the task is *marked* for cancellation. 
The actual cancellation requires a context switch (await asyncio.sleep(0) or 
similar) to propagate `asyncio.CancelledError` into the task code and unwind 
the exception.

As I said, the test needs a context switch between `cancel()` call and 
analyzing the state after the task cancellation.

Futures are canceled immediately, that's why the previous implementation passed 
uvloop's test suite untouched. Unfortunately, it had own flaws.
Also please note, sock_connect()/sock_accept() were implemented this way about 
two years before my changes, they also suffer from 
cancel-without-actual-cancellation problems as well.

----------

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

Reply via email to