Allow start_clock() to start the very first system task; make MockClock do so#1579
Allow start_clock() to start the very first system task; make MockClock do so#1579oremanj wants to merge 3 commits intopython-trio:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1579 +/- ##
=======================================
Coverage 99.69% 99.69%
=======================================
Files 111 111
Lines 13866 13866
Branches 1059 1059
=======================================
Hits 13824 13824
Misses 27 27
Partials 15 15
|
|
What do you think of the idea discussed in the last few paragraphs of this comment, of making |
|
Interesting! I had rather glossed over that issue before, but have now gone back and read it in detail. I think the instrument-based MockClock is going to be challenging to make work in all edge cases without more instrumentation hooks churn than I'm up for right now. (This issue is to unblock #1521, which together with #1543 unblocks #1564 and #1537... the yak stack depth is getting intimidating!) I commented on #239 with some hazards I saw when I sat down to try it. I certainly don't mind removing the unusual system_nursery initialization in this PR if MockClock later changes to make it unnecessary. |
|
I'm intrigued by the idea in this PR to make our bootstrap code start by creating a nursery, instead of starting by creating a task. It's not something I've really thought about before. As far as fixing |
|
Closing this in favor of #1588. If we later need the system nursery to exist earlier for something else, that's what version control is for! |
Preparatory to #1521 in which the order will do anything. As discussed in #265, the autojumper should be the very last thing to get shut down, even after the run_sync_soon task.
This requires some shenanigans because start_clock() runs before the first step of init. We effectively execute the system nursery
__aenter__outside of async context, so as to have a system nursery when start_clock() runs.