summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-task.rst
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2021-12-19 11:22:40 (GMT)
committerGitHub <noreply@github.com>2021-12-19 11:22:40 (GMT)
commitda4b214304df38cf1831071804a2b83938f95923 (patch)
tree9823fdba80b7228c6069824c89a3113d215fd6c3 /Doc/library/asyncio-task.rst
parent9b52920173735ac609664c6a3a3021d24a95a092 (diff)
downloadcpython-da4b214304df38cf1831071804a2b83938f95923.zip
cpython-da4b214304df38cf1831071804a2b83938f95923.tar.gz
cpython-da4b214304df38cf1831071804a2b83938f95923.tar.bz2
bpo-42413: Replace `concurrent.futures.TimeoutError` and `asyncio.TimeoutError` with builtin `TimeoutError` (GH-30197)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Diffstat (limited to 'Doc/library/asyncio-task.rst')
-rw-r--r--Doc/library/asyncio-task.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index bfc983e..cbc42ac 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -490,7 +490,7 @@ Timeouts
completes.
If a timeout occurs, it cancels the task and raises
- :exc:`asyncio.TimeoutError`.
+ :exc:`TimeoutError`.
To avoid the task :meth:`cancellation <Task.cancel>`,
wrap it in :func:`shield`.
@@ -520,7 +520,7 @@ Timeouts
# Wait for at most 1 second
try:
await asyncio.wait_for(eternity(), timeout=1.0)
- except asyncio.TimeoutError:
+ except TimeoutError:
print('timeout!')
asyncio.run(main())
@@ -532,7 +532,7 @@ Timeouts
.. versionchanged:: 3.7
When *aw* is cancelled due to a timeout, ``wait_for`` waits
for *aw* to be cancelled. Previously, it raised
- :exc:`asyncio.TimeoutError` immediately.
+ :exc:`TimeoutError` immediately.
.. deprecated-removed:: 3.8 3.10
The ``loop`` parameter. This function has been implicitly getting the
@@ -561,7 +561,7 @@ Waiting Primitives
*timeout* (a float or int), if specified, can be used to control
the maximum number of seconds to wait before returning.
- Note that this function does not raise :exc:`asyncio.TimeoutError`.
+ Note that this function does not raise :exc:`TimeoutError`.
Futures or Tasks that aren't done when the timeout occurs are simply
returned in the second set.
@@ -649,7 +649,7 @@ Waiting Primitives
Each coroutine returned can be awaited to get the earliest next
result from the iterable of the remaining awaitables.
- Raises :exc:`asyncio.TimeoutError` if the timeout occurs before
+ Raises :exc:`TimeoutError` if the timeout occurs before
all Futures are done.
.. deprecated-removed:: 3.8 3.10
@@ -762,7 +762,7 @@ Scheduling From Other Threads
try:
result = future.result(timeout)
- except concurrent.futures.TimeoutError:
+ except TimeoutError:
print('The coroutine took too long, cancelling the task...')
future.cancel()
except Exception as exc: