-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
bpo-41543: contextlib.nullcontext can fill in for an async context manager #21870
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.
Missing a test
Yes, please add a test and update the docs. |
It might be tidier to have a separate NullAsyncContext. |
Because |
Added test and updated docs :) |
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.
Still need to squash the commits.
f66ed86
to
c208250
Compare
I fixed the example and squashed the commits |
Looks like there are still 4 commits. It will be easier for people looking at this change in the future if the code change, test, and documentation change are all in a single commit. |
c208250
to
148d2fd
Compare
My bad, thought that if the commits get |
For what it's worth, the developer's guide states that squashing should be avoided. |
148d2fd
to
48c95c6
Compare
Is this gonna get merged? |
@ZackerySpytz, I see what you mean now - the core devs squash commits on merge so it doesn't matter if the PR is messy. Thanks for pointing this out. |
Yes, this is ready for merge. Just trying to get the CI pass. |
I guess this can be merged now. |
Is this gonna get merged someday? Is there a way to fix the broken CI? |
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.
LGTM.
As the aiohttp author, I never use such approach :)
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.
Need ..versionchanged:: 3.10
directive in docs that says 'added support for async context manager' or something like this
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
@asvetlov Do you feel it's better to add the directive before my example, or that an another example for |
…nager Add NEWS.d blurb Add tests Fix test Update nullcontext docs Fix example in docs Format lines
48c95c6
to
400497b
Compare
I expect to see |
I got that, but I question whether to remove my example entirely and leave only the directive. |
I think the example is fine, but Updated docs. |
Thanks for the patience! |
…nager (pythonGH-21870) Co-authored-by: Andrew Svetlov <[email protected]>
Make
contextlib.nullcontext
implementAbstractAsyncContextManager
, so it can be used as a fill in for async context mangers.https://bugs.python.org/issue41543