Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22b1128

Browse files
authored
bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319)
1 parent 39a156c commit 22b1128

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ Future
216216
raise an exception when the future isn't done yet.
217217

218218
- Callbacks registered with :meth:`add_done_callback` are always called
219-
via the event loop's :meth:`~AbstractEventLoop.call_soon_threadsafe`.
219+
via the event loop's :meth:`~AbstractEventLoop.call_soon`.
220220

221221
- This class is not compatible with the :func:`~concurrent.futures.wait` and
222222
:func:`~concurrent.futures.as_completed` functions in the

Lib/asyncio/futures.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ class Future:
3232
3333
Differences:
3434
35+
- This class is not thread-safe.
36+
3537
- result() and exception() do not take a timeout argument and
3638
raise an exception when the future isn't done yet.
3739
3840
- Callbacks registered with add_done_callback() are always called
39-
via the event loop's call_soon_threadsafe().
41+
via the event loop's call_soon().
4042
4143
- This class is not compatible with the wait() and as_completed()
4244
methods in the concurrent.futures package.

0 commit comments

Comments
 (0)