-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Ensure guest run is initialized when start_guest_run() returns #2696
Ensure guest run is initialized when start_guest_run() returns #2696
Conversation
88f604d
to
db3853a
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2696 +/- ##
=======================================
Coverage 98.94% 98.94%
=======================================
Files 113 113
Lines 16851 16885 +34
Branches 3032 3036 +4
=======================================
+ Hits 16673 16707 +34
Misses 123 123
Partials 55 55
|
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.
This looks sane and makes sense to me (though I have a couple bits I don't get, like next_send
being different on Windows and non-Windows), but I really don't know how guest runs work or anything like that.
Probably wait for someone else to review!
|
Well, hopefully someone with knowledge reviews this + #2700 in the near future! (Just bumping this :P ) |
This PR has a typing "problem" in that it correctly sends |
Run a few ticks of the guest run synchronously within
start_guest_run
, so that global Trio operations such ascurrent_time()
andspawn_system_task()
work as soon asstart_guest_run
returns (rather than at some indefinite point in the near future).Motivating use case: allowing trio/asyncio integration beginning from asyncio mode to start up a Trio run and create a backing Trio task for an asyncio task that's about to enter Trio mode, all from a sync-colored context. The reverse (starting an asyncio guest run synchronously) is already supported by aioguest and is necessary to support sync-colored wrappers around asyncio-flavored async functions; that idiom is less common for Trio-flavored code, but it's still convenient to be able to treat both directions of transition in the same way, and it seems likely this PR could simplify other guest-mode wrappers as well.