[New-bugs-announce] [issue47167] Allow overriding future-task compliance check in asyncio

Andrew Svetlov report at bugs.python.org
Wed Mar 30 11:34:50 EDT 2022


New submission from Andrew Svetlov <andrew.svetlov at gmail.com>:

Now asyncio.Task has a strict hardcoded check for futures processes on task's step.
Sometimes third-party library [1] wants to replace it with custom logic.
Currently it is impossible without implementing the full asyncio.Task replacement from scratch.
`asyncio.Task` is a non-trivial highly optimized part of async, keeping a third-party version in sync with the reference implementation takes more time and effort than it should be.

This issue proposes adding `Task._check_future(future)` method that could be overridden in subclasses.  The default C implementation uses a fast path that has no performance penalty.

1. https://github.com/aio-libs/aioloop-proxy implements nested loop proxies that are very useful for writing tests. A proxy can work in parallel with ancestors but checks all own acquired resources cleanup on 
the proxy closing.

----------
components: asyncio
messages: 416374
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Allow overriding future-task compliance check in  asyncio
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47167>
_______________________________________


More information about the New-bugs-announce mailing list