-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make TaskStatus.started() never return success upon failure
Specifically, make started() reparent the task even if the start() call is in an effectively cancelled scope when started() is called, and check sys.exc_info() to prevent calling task_status.started() while handling active Cancelled(s).
- Loading branch information
1 parent
39bc92a
commit b038de5
Showing
2 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
When :func:`trio.TaskStatus.started` is called in a cancelled scope, it no | ||
longer returns (indicating that the task has been moved and is now running as a | ||
child of the nursery) without actually moving the task. Previously, | ||
:func:`trio.TaskStatus.started` would not move the task in this scenario, | ||
causing the call to :func:`trio.Nursery.start` to incorrectly wait until the | ||
started task finished, which caused deadlocks and other issues. | ||
|
||
:func:`trio.TaskStatus.started` is no longer allowed to be called by an | ||
exception handler that is handling one or more :exc:`Cancelled` exceptions; | ||
attempting to do so will now raise a :exc:`RuntimeError`. Note that any code | ||
that did this prior to this ban was already buggy, because it was attempting to | ||
teleport :exc:`Cancelled` exception(s) to a place in the task tree without the | ||
corresponding :class:`CancelScope`(s) to catch them. |
This file contains 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