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 asyncio.Runner docs about loop_factory #95979

Merged
merged 1 commit into from Aug 14, 2022
Merged

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Aug 14, 2022

No description provided.

Copy link
Member

@gvanrossum gvanrossum left a comment

Thanks, this clarifies everything.

@gvanrossum gvanrossum merged commit e8259e0 into python:main Aug 14, 2022
14 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Aug 14, 2022

Thanks @kumaraditya303 for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 14, 2022
(cherry picked from commit e8259e0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
@bedevere-bot
Copy link

bedevere-bot commented Aug 14, 2022

GH-95982 is a backport of this pull request to the 3.11 branch.

miss-islington added a commit that referenced this issue Aug 14, 2022
(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
Copy link
Contributor

@graingert graingert Aug 14, 2022

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?

Copy link
Member

@gvanrossum gvanrossum Aug 14, 2022

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.

Copy link
Contributor

@graingert graingert Aug 14, 2022

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?

Copy link
Member

@gvanrossum gvanrossum Aug 14, 2022

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.

@kumaraditya303 kumaraditya303 deleted the docs branch Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants