bpo-34430: double chaining futures in asyncio.wrap_future by alfred-sa · Pull Request #8804 · python/cpython

asyncio.future.wrap_future is used to wrap a concurrent.future.Future in a asyncio.future.Future.

The actual implementation as the following behaviours :

  1. When the concurrent.future.Future gets a result, the asyncio.future.Future gets the same result,
  2. When the asyncio.future.Future is cancelled, the concurrent.future.Future is cancelled

I wonder why the futures synchronisation is not symmetrical ?
I propose to add the following behaviours :

  1. When the asyncio.future.Future gets a result, the concurrent.future.Future gets the same result,
  2. When the concurrent.future.Future is cancelled, the asyncio.future.Future is cancelled

If there is good reasons to not implement the proposed behaviours, I would be glad to know.

Thank you !

https://bugs.python.org/issue34430