-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Delay deciding which cancel scope a Cancelled exception belongs to #901
Conversation
Codecov Report
@@ Coverage Diff @@
## master #901 +/- ##
==========================================
- Coverage 99.53% 99.53% -0.01%
==========================================
Files 102 102
Lines 12411 12397 -14
Branches 916 915 -1
==========================================
- Hits 12353 12339 -14
Misses 36 36
Partials 22 22
|
Codecov Report
@@ Coverage Diff @@
## master #901 +/- ##
==========================================
- Coverage 99.53% 99.53% -0.01%
==========================================
Files 102 102
Lines 12411 12409 -2
Branches 916 915 -1
==========================================
- Hits 12353 12351 -2
Misses 36 36
Partials 22 22
|
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.
Huh, this is simpler than I was expecting :-)
trio/_core/_exceptions.py
Outdated
crash your program. Use :meth:`cancel_scope.cancel() | ||
<trio.CancelScope.cancel>` instead, so Trio can maintain the | ||
invariant that a :exc:`Cancelled` exception only gets raised when | ||
there's a cancelled cancel scope that's intended to catch it. |
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 is probably more details on the internals than we really want people thinking about. How about simplifying down to just: "You cannot raise Cancelled yourself. Attempting to do so will produce a RuntimeError. Use cancel_scope.cancel instead."
The 3.8-dev failure in Travis is unrelated, so I think this is ready. |
LGTM. That travis failure is annoying... I just filed a bug on CPython (bpo-35894), so hopefully it will be fixed soon. In the mean time though our CI is broken. I guess we need to temporarily disable the 3.8-dev test (or mark it "allowed to fail") until that's fixed? |
Closing/opening to tickle CI, now that #905 is merged. |
This time |
Fixes python-trio#320. Now that python-trio#901 is implemented, the concerns discussed in python-trio#835 don't apply.
Fixes #860.