File tree Expand file tree Collapse file tree 5 files changed +273
-166
lines changed Expand file tree Collapse file tree 5 files changed +273
-166
lines changed Original file line number Diff line number Diff line change @@ -514,23 +514,7 @@ objects.
514
514
exception, and (2) this scope is the one that was responsible
515
515
for triggering this :exc: `~trio.Cancelled ` exception.
516
516
517
- .. attribute :: cancel_called
518
-
519
- Readonly :class: `bool `. Records whether cancellation has been
520
- requested for this scope, either by an explicit call to
521
- :meth: `cancel ` or by the deadline expiring.
522
-
523
- This attribute being True does *not * necessarily mean that the
524
- code within the scope has been, or will be, affected by the
525
- cancellation. For example, if :meth: `cancel ` was called after
526
- the last checkpoint in the ``with `` block, when it's too late to
527
- deliver a :exc: `~trio.Cancelled ` exception, then this attribute
528
- will still be True.
529
-
530
- This attribute is mostly useful for debugging and introspection.
531
- If you want to know whether or not a chunk of code was actually
532
- cancelled, then :attr: `cancelled_caught ` is usually more
533
- appropriate.
517
+ .. autoattribute :: cancel_called
534
518
535
519
536
520
Trio also provides several convenience functions for the common
Original file line number Diff line number Diff line change
1
+ The plumbing of Trio's cancellation system has been substantially overhauled
2
+ to improve performance and ease future planned improvements. Notably, there is
3
+ no longer any internal concept of a "cancel stack", and checkpoints now take
4
+ constant time regardless of the cancel scope nesting depth.
Original file line number Diff line number Diff line change
1
+ Inspecting the :attr: `~trio.CancelScope.cancel_called ` attribute of a
2
+ not-yet-exited cancel scope whose deadline is in the past now always
3
+ returns ``True ``, like you might expect. (Previously it would return
4
+ ``False `` for not-yet-entered cancel scopes, and for active cancel
5
+ scopes until the first checkpoint after their deadline expiry.)
You can’t perform that action at this time.
0 commit comments