Make trio.from_thread.run() raise RunFinishedError if the system nursery is closed#1743
Merged
njsmith merged 2 commits intopython-trio:masterfrom Oct 14, 2020
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1743 +/- ##
=======================================
Coverage 99.63% 99.64%
=======================================
Files 114 114
Lines 14427 14446 +19
Branches 1104 1104
=======================================
+ Hits 14375 14394 +19
Misses 37 37
Partials 15 15
|
belm0
approved these changes
Oct 11, 2020
Comment on lines
+1
to
+2
| # coding: utf-8 | ||
|
|
Member
There was a problem hiding this comment.
these headers should not be needed, right?
in the few files where this appears, git blame is always referencing your PR's. Over-eager editor setting?
Member
There was a problem hiding this comment.
@belm0 Not needed indeed, feel free to remove those lines
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1738. Also improve the documentation for spawn_system_task() to more clearly indicate this possibility.
Rationale for RunFinishedError: callers to
from_thread.run()already need to be able to handle the case where the run is finished, and it's difficult to distinguish "has started async generator finalization" from the case where the run is fully done. I would also entertain other options (raise Cancelled? block until the run actually finishes and then raise RunFinishedError?) if anyone wants to make a case for why a different choice might be more robust.