Author yselivanov
Recipients Elvis.Pranskevichus, asvetlov, yselivanov
Date 2018-10-02.19:30:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538508638.07.0.545547206417.issue34872@psf.upfronthosting.co.za>
In-reply-to
Content
Vladimir Matveev has discovered that C and Python implementation of asyncio.Task diverge:

* asynciomodule.c:
https://github.com/python/cpython/blob/9012a0fb4c4ec1afef9efb9fdb0964554ea17983/Modules/_asynciomodule.c#L2716

* tasks.py:
https://github.com/python/cpython/blob/9012a0fb4c4ec1afef9efb9fdb0964554ea17983/Lib/asyncio/tasks.py#L286

In tasks.py we call "fut_obj.cancel()", so either "Task.cancel()" or "Future.cancel()" can be called depending on what "fut_obj" is.

In asynciomodule.c we essentially always call "Future.cancel(fut_obj)".  This probably leads to unexpected behaviour if "fut_obj" is either a Task or a Task subclass with an overloaded "cancel()" method.

We need to first write a set of tests to understand the scope of this; then we'll need to patch asynciomodule.c and backport this to 3.7 & 3.6.
History
Date User Action Args
2018-10-02 19:30:38yselivanovsetrecipients: + yselivanov, asvetlov, Elvis.Pranskevichus
2018-10-02 19:30:38yselivanovsetmessageid: <1538508638.07.0.545547206417.issue34872@psf.upfronthosting.co.za>
2018-10-02 19:30:38yselivanovlinkissue34872 messages
2018-10-02 19:30:37yselivanovcreate