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

gh-102780: Fix uncancel() call in asyncio timeouts#102815

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gvanrossum merged 13 commits intopython:mainfrommainframeindustries:kristjan/uncancel
Mar 22, 2023
Merged
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
9f96cea
document use of uncancel() when suppressing CancelledError
kristjanvalurMar 18, 2023
07517b7
Create unittest
kristjanvalurMar 18, 2023
1150db0
record previous cancel state in timeout context manager
kristjanvalurMar 18, 2023
d207fb1
explicitly raise from cancelled error
kristjanvalurMar 18, 2023
912f26d
Update Doc/library/asyncio-task.rst
kristjanvalurMar 20, 2023
ee574fc
Clarify how code should "ignore" CancelledError
kristjanvalurMar 20, 2023
c91dae7
Apply suggestions from code review
kristjanvalurMar 20, 2023
902691e
Add unittest for asyncio.TimeoutError.__cause__
kristjanvalurMar 20, 2023
0f7bde5
Merge branch 'main' into kristjan/uncancel
kristjanvalurMar 20, 2023
07c40cc
add news
kristjanvalurMar 22, 2023
2a8914e
Merge branch 'main' into kristjan/uncancel
kristjanvalurMar 22, 2023
a6f3114
Rename news file
kristjanvalurMar 22, 2023
6e299fa
fix news entry
kristjanvalurMar 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
document use of uncancel() when suppressing CancelledError
  • Loading branch information
@kristjanvalur
kristjanvalur committedMar 18, 2023
commit9f96cea0deb91dcdeb79d143fb89c0280e6e4add
13 changes: 11 additions & 2 deletionsDoc/library/asyncio-task.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -306,7 +306,10 @@ The asyncio components that enable structured concurrency, like
:class:`asyncio.TaskGroup` and :func:`asyncio.timeout`,
are implemented using cancellation internally and might misbehave if
a coroutine swallows :exc:`asyncio.CancelledError`. Similarly, user code
should not call :meth:`uncancel <asyncio.Task.uncancel>`.
should not generally call :meth:`uncancel <asyncio.Task.uncancel>`.
However, in such cases when supprssing :exc:`asynci.CancelledError` is
truly desired, it is necessary to also call :meth:`uncancel` to completely
remove the cancellation state.

.. _taskgroups:

Expand DownExpand Up@@ -1148,7 +1151,9 @@ Task Object
Therefore, unlike :meth:`Future.cancel`, :meth:`Task.cancel` does
not guarantee that the Task will be cancelled, although
suppressing cancellation completely is not common and is actively
discouraged.
discouraged. Should the coroutine nevertheless decide to suppress
the cancellation, it needs to call :meth:`Task.uncancel` in addition
to catching the exception.

.. versionchanged:: 3.9
Added the *msg* parameter.
Expand DownExpand Up@@ -1238,6 +1243,10 @@ Task Object
with :meth:`uncancel`. :class:`TaskGroup` context managers use
:func:`uncancel` in a similar fashion.

If end-user code is, for some reason, suppresing cancellation by
catching :exc:`CancelledError`, it needs to call this method to remove
the cancellation state.

.. method:: cancelling()

Return the number of pending cancellation requests to this Task, i.e.,
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp