Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new base class for loop scoped variables in asyncio #128633

Open
kumaraditya303 opened this issue Jan 8, 2025 · 1 comment
Open

Add a new base class for loop scoped variables in asyncio #128633

kumaraditya303 opened this issue Jan 8, 2025 · 1 comment

Comments

@kumaraditya303
Copy link
Contributor

We have several loop-scoped global variables now. Some are Python objects, but llist_node is a plain C structure.
Let's make a super-base C Extension class where we can put all these objects (both python and plain C) and inherit BaseEventLoop from it.
I personally feel that we will have more loop-scoped things like llist_node in the future; now is a good time to settle a place for them.

Originally posted by @asvetlov in #128416 (comment)

@graingert
Copy link
Contributor

graingert commented Jan 8, 2025

Could you expose these so user code can use it? I'd like to implement RunVars - which are like ContextVars but for a particular asyncio.run. currently we use WeakKeyDictionaries from loop to object

We also use WeakKeyDictionaries to map from task to the CancelScope it's in. I'd like to make one WeakKeyDictionary per event loop rather than having one global one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

3 participants