From: Antoine Pitrou Date: Tue, 7 Nov 2017 16:03:28 +0000 (+0100) Subject: bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319) X-Git-Tag: v3.7.0a3~221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22b1128559bdeb96907da5840960691bb050d11a;p=python bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319) --- diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index fbb31b866a..ff35b0add9 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -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 diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 215f72d191..3dc9c500b3 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -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.