diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-07-01 02:13:22 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-07-01 02:13:22 (GMT) |
commit | 04356e1f6f8f3bca6eaf07d7772813e7f2ba8282 (patch) | |
tree | 7d6312d8aa83a89e5603a73444af968b5c25fde2 /Doc/library/asyncio-dev.rst | |
parent | 59a3b6764c504b4816b83be97d05f365f68d7dea (diff) | |
download | cpython-04356e1f6f8f3bca6eaf07d7772813e7f2ba8282.zip cpython-04356e1f6f8f3bca6eaf07d7772813e7f2ba8282.tar.gz cpython-04356e1f6f8f3bca6eaf07d7772813e7f2ba8282.tar.bz2 |
Issue #24487: Rename async() -> ensure_future() in asyncio docs.
Patch by Martin Panter.
Diffstat (limited to 'Doc/library/asyncio-dev.rst')
-rw-r--r-- | Doc/library/asyncio-dev.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/library/asyncio-dev.rst b/Doc/library/asyncio-dev.rst index 3a196db..e27cef8 100644 --- a/Doc/library/asyncio-dev.rst +++ b/Doc/library/asyncio-dev.rst @@ -99,7 +99,7 @@ To schedule a callback from a different thread, the :meth:`BaseEventLoop.call_soon_threadsafe` method should be used. Example to schedule a coroutine from a different thread:: - loop.call_soon_threadsafe(asyncio.async, coro_func()) + loop.call_soon_threadsafe(asyncio.ensure_future, coro_func()) Most asyncio objects are not thread safe. You should only worry if you access objects outside the event loop. For example, to cancel a future, don't call @@ -162,10 +162,10 @@ Detect coroutine objects never scheduled ---------------------------------------- When a coroutine function is called and its result is not passed to -:func:`async` or to the :meth:`BaseEventLoop.create_task` method, the execution -of the coroutine object will never be scheduled which is probably a bug. -:ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` to :ref:`log a -warning <asyncio-logger>` to detect it. +:func:`ensure_future` or to the :meth:`BaseEventLoop.create_task` method, +the execution of the coroutine object will never be scheduled which is +probably a bug. :ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` +to :ref:`log a warning <asyncio-logger>` to detect it. Example with the bug:: @@ -184,7 +184,7 @@ Output in debug mode:: File "test.py", line 7, in <module> test() -The fix is to call the :func:`async` function or the +The fix is to call the :func:`ensure_future` function or the :meth:`BaseEventLoop.create_task` method with the coroutine object. .. seealso:: |