-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
GH-82604: fix docs about configuring event loop #97755
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this approach. Let's instead update the example to use set_event_loop_policy()
instead. That is honored by asyncio.run()
so we won't need the note.
(Didn't the OP mention this is also a problem with the proactor docs?)
Do you mean to subclass the policy and then override the selector?
I didn't find any mention in proactor docs. |
Yeah, it looks like you can do something like this (untested) class MyPolicy(asyncio.DefaultEventLoopPolicy):
def new_event_loop(self):
selector = <what the example had>
return asyncio.SelectorEventLoop(selector)
asyncio.set_event_loop_policy(MyPolicy()) |
Okay no worries about that then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it!
Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
GH-97832 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
GH-97833 is a backport of this pull request to the 3.10 branch. |
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
(cherry picked from commit 53503ff) Co-authored-by: Kumar Aditya <[email protected]>
Closes #82604