Preserve contextvars during comm offload #5486
Merged
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.
Not currently used for anything, so debatable if we want to merge this now. However, this will eventually help with #5485, I had already written the code in #5473, and perhaps it'll save someone else future confusion.
Implementation referenced from python/cpython#9688
Originally I used this for 30af07e, which I thought about opening a PR for. However, I think we should take a more general approach, namely #5485 and cleaning up all the inconsistencies around
get_client()
,Client.current()
,default_client()
, andget_worker()
.cc @crusaderky @fjetter
pre-commit run --all-files