Add API for changing the context of a running task.
This is implemented as an asynchronous context manager (allowing arbitrary nesting).
Codecov Report
Merging #2086 (24b3814) into master (f8cb817) will increase coverage by
0.00%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #2086 +/- ##
=======================================
Coverage 99.55% 99.55%
=======================================
Files 114 116 +2
Lines 14751 14785 +34
Branches 2341 2344 +3
=======================================
+ Hits 14685 14719 +34
Misses 44 44
Partials 22 22
| Impacted Files | Coverage Δ | |
|---|---|---|
| trio/lowlevel.py | 100.00% <ø> (ø) |
|
| trio/_core/__init__.py | 100.00% <100.00%> (ø) |
|
| trio/_core/_context.py | 100.00% <100.00%> (ø) |
|
| trio/_core/tests/test_context.py | 100.00% <100.00%> (ø) |
Hmm, I'd call this function changed_context so that the with statement reads like a reasonable English phrase.
That's inconsistent with every other context manager in the library.
If there's no objections to this in the next four days I'm going to merge this unilaterally.
I have some mixed feelings about the "I'm going to commit this regardless of review once it's been up for a week" -- I think based on typical review habits in this project that a week of silence doesn't actually constitute a mandate to go ahead.
This feature is blocking the project I'm working on. Given that it's a ten line feature change, relatively simple, and that the review was primarily about semantics I think that it's fair to expect this could be pushed through quickly.
This feature is blocking the project I'm working on. Given that it's a ten line feature change, relatively simple, and that the review was primarily about semantics I think that it's fair to expect this could be pushed through quickly.
You could inline change_context() into your project in the meantime -- it doesn't actually use any private APIs. I'm not trying to pass judgment on whether pushing on this change's timeline was abstractly fair or not; mostly wanted to flag that I was personally somewhat taken aback by the approach.
@Fuyukai any progress on this?
Hi, I picked this back up again after ~five months of being a writer :)
I addressed all the comments raised by @oremanj. I also wish to apologise for my rash behaviour and threatening a unilateral merge.