New submission from Yury Selivanov <yseliva...@gmail.com>:

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.

----------
components: asyncio
messages: 326896
nosy: Elvis.Pranskevichus, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: investigate task/future cancellation in asynciomodule.c
versions: Python 3.6, Python 3.7, Python 3.8

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

Reply via email to