Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb36f01d

Browse files
authored
gh-141186: documentasyncio.Task cancellation propagation behavior (#141249)
1 parent0ac890b commitb36f01d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎Doc/library/asyncio-task.rst‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,8 @@ Task Object
12211221

12221222
To cancel a running Task use the:meth:`cancel` method. Calling it
12231223
will cause the Task to throw a:exc:`CancelledError` exception into
1224-
the wrapped coroutine. If a coroutine is awaiting on aFuture
1225-
object during cancellation, theFuture object will be cancelled.
1224+
the wrapped coroutine. If a coroutine is awaiting on afuture-like
1225+
object during cancellation, theawaited object will be cancelled.
12261226

12271227
:meth:`cancelled` can be used to check if the Task was cancelled.
12281228
The method returns ``True`` if the wrapped coroutine did not
@@ -1411,6 +1411,10 @@ Task Object
14111411
the cancellation, it needs to call:meth:`Task.uncancel` in addition
14121412
to catching the exception.
14131413

1414+
If the Task being cancelled is currently awaiting on a future-like
1415+
object, that awaited object will also be cancelled. This cancellation
1416+
propagates down the entire chain of awaited objects.
1417+
14141418
..versionchanged::3.9
14151419
Added the *msg* parameter.
14161420

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp