This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients abacabadabacaba, asvetlov, lukasz.langa, ned.deily, yselivanov
Date 2020-02-26.12:39:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582720743.89.0.419347264589.issue30064@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-02-26 12:39:03asvetlovsetrecipients: + asvetlov, ned.deily, abacabadabacaba, lukasz.langa, yselivanov
2020-02-26 12:39:03asvetlovsetmessageid: <1582720743.89.0.419347264589.issue30064@roundup.psfhosted.org>
2020-02-26 12:39:03asvetlovlinkissue30064 messages
2020-02-26 12:39:03asvetlovcreate