Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-31960: Fix asyncio.Future documentation for thread (un)safety. #4319

Merged
merged 1 commit into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Future
raise an exception when the future isn't done yet.

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

- This class is not compatible with the :func:`~concurrent.futures.wait` and
:func:`~concurrent.futures.as_completed` functions in the
Expand Down
4 changes: 3 additions & 1 deletion Lib/asyncio/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ class Future:

Differences:

- This class is not thread-safe.

- result() and exception() do not take a timeout argument and
raise an exception when the future isn't done yet.

- Callbacks registered with add_done_callback() are always called
via the event loop's call_soon_threadsafe().
via the event loop's call_soon().

- This class is not compatible with the wait() and as_completed()
methods in the concurrent.futures package.
Expand Down