-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-125862: Context decorator support for generators and async functions #136212
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bd00fcb
gh-125862: Improve context decorator support for generators and async…
agronholm 1a0c100
Merge branch 'main' into fix-issue-125862
agronholm 9b3ba13
📜🤖 Added by blurb_it.
blurb-it[bot] 8535a21
Manually iterate coroutines to avoid asyncio use
agronholm 6a68ffb
Merge branch 'main' into fix-issue-125862
agronholm bbaee0c
Merge branch 'main' into fix-issue-125862
agronholm 93b30f4
Merge branch 'main' into fix-issue-125862
agronholm 1fd52d5
Make sure we at least try to close the generators
agronholm e32191e
Merge remote-tracking branch 'fork/fix-issue-125862' into fix-issue-1…
agronholm 65c8f50
Use (a)closing
agronholm 8762048
Merge branch 'main' into fix-issue-125862
agronholm 6fb5bcb
Merge remote-tracking branch 'origin/main' into fix-issue-125862
gpshead 1433534
Use _private imports
gpshead a8ee60d
performance: only define inner funcs on the branch that uses them, la…
gpshead 46ffa37
do not delete that newline (small diff)
gpshead ed6d9fa
reword reST news entry
gpshead 876704a
Preserve generator return value; expand decorator test coverage
gpshead 3b30193
Document ContextDecorator generator/coroutine handling
gpshead 72d4a8e
Add What's New entry for ContextDecorator generator support
gpshead 719c55c
simplify lazy import syntax
gpshead 59422a3
Reword AsyncContextDecorator docs to lead with intended async use
gpshead 7026b14
Reword test comments to state the contract, not the mechanism
gpshead c6eda4a
Test send/throw forwarding for the sync wrapper; pin async limitation
gpshead a3cfb1a
also add my name in whatsnew
gpshead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2025-07-02-17-01-17.gh-issue-125862.WgFYj3.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Improved ``@contextmanager`` and ``@asynccontextmanager`` to work correctly with generators, coroutine functions and async generators when the wrapped callables are used as decorators |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.