Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aiorpcx: fix bug in timeout_after monkeypatch
fixes #7952 see in particular #7952 (comment) > So the issue is with the aiorpcx monkey patch in util.py, as it > relies on side-effecting the asyncio.Task, and it patches Task.cancel. > However, aiohttp also uses Task.cancel for its own timeouting of the > http request, with the same Task object, and this confuses timeout_after. > Ultimately FxThread.run exits. related kyuupichan/aiorpcX#47 --- note: I am not content at all with this monkey-patching approach, but at the same time I don't see how to properly fix this handling all edge-cases in aiorpcx. python 3.11 is finally adding an implementation of TaskGroup [0] and an async timeout context manager [1] in the asyncio module of the stdlib. Looking at the implementations, they look unfeasible to backport: much of the implementation of asyncio.Task had to be changed for them to work, and TaskGroup in particular relies on the new ExceptionGroups. Some of these edge cases we are battling with aiorpcx.curio look difficult to fix without those stdlib changes... Anyway, when we bump the min python to 3.11, I look forward to switching to that code instead, and ripping this stuff out. [0]: https://docs.python.org/3.11/library/asyncio-task.html#task-groups [1]: https://docs.python.org/3.11/library/asyncio-task.html#asyncio.timeout
- Loading branch information