This repository was archived by the owner on Feb 13, 2025. It is now read-only.
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Add support for PEP 567 context variables to tasklets #239
Closed
Description
Python 3.7 added the context variables and the module contextvars. See PEP 567 for details.
Using tasklets it is possible to decorate a plain old callable as a coroutine (and vice versa). To make such a coroutine fully compatible with C-Python asyncio tasklets should support PEP 567 context variables. In C-Python the current context is a property of the thread state, that is, each thread has its own current context. In Stackless Python a thread can have multiple tasklets. Therefore the current context must become a property of the tasklet.
I'm still elaborating details.