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 asyncio.Runner docs about loop_factory
#95979
Conversation
|
Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it |
(cherry picked from commit e8259e0) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
|
GH-95982 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit e8259e0) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
| @@ -75,7 +75,9 @@ Runner context manager | |||
| :ref:`asyncio-debug-mode` settings. | |||
|
|
|||
| *loop_factory* could be used for overriding the loop creation. | |||
| :func:`asyncio.new_event_loop` is used if ``None``. | |||
| It is the responsibility of the *loop_factory* to set the created loop as the | |||
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.
Who's responsibility is to unset it? Should Runner always set it to None or should the author of the loop_factory function?
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.
The Runner also unsets it when closed/exited. If you feel that this needs to be called out please open a new PR.
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.
Runner only unsets it in close if it is the one that sets it.
so the caller of Runner is responsible for unsetting it, and they need to unset it before the loop is closed so the childwatchers that join threads join them before the loop closes?
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.
Runner only unsets it in close if it is the one that sets it.
Which makes sense, right?
so the caller of Runner is responsible for unsetting it, and they need to unset it before the loop is closed so the childwatchers that join threads join them before the loop closes?
That sounds like a criticism of the code. I don't know enough about child watchers to be able to answer.
No description provided.