Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
04356e1f
Kaydet (Commit)
04356e1f
authored
Tem 01, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24487: Rename async() -> ensure_future() in asyncio docs.
Patch by Martin Panter.
üst
59a3b676
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
asyncio-dev.rst
Doc/library/asyncio-dev.rst
+6
-6
asyncio-eventloop.rst
Doc/library/asyncio-eventloop.rst
+1
-1
asyncio-protocol.rst
Doc/library/asyncio-protocol.rst
+3
-3
asyncio-task.rst
Doc/library/asyncio-task.rst
+3
-3
No files found.
Doc/library/asyncio-dev.rst
Dosyayı görüntüle @
04356e1f
...
@@ -99,7 +99,7 @@ To schedule a callback from a different thread, the
...
@@ -99,7 +99,7 @@ To schedule a callback from a different thread, the
:meth:`BaseEventLoop.call_soon_threadsafe` method should be used. Example to
:meth:`BaseEventLoop.call_soon_threadsafe` method should be used. Example to
schedule a coroutine from a different thread::
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
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
objects outside the event loop. For example, to cancel a future, don't call
...
@@ -162,10 +162,10 @@ Detect coroutine objects never scheduled
...
@@ -162,10 +162,10 @@ Detect coroutine objects never scheduled
----------------------------------------
----------------------------------------
When a coroutine function is called and its result is not passed to
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
:func:`
ensure_future` or to the :meth:`BaseEventLoop.create_task` method,
of the coroutine object will never be scheduled which is probably a bug.
the execution of the coroutine object will never be scheduled which is
:ref:`Enable the debug mode of asyncio <asyncio-debug-mode>` to :ref:`log a
probably a bug. :ref:`Enable the debug mode of asyncio <asyncio-debug-mode>`
warning <asyncio-logger>` to detect it.
to :ref:`log a
warning <asyncio-logger>` to detect it.
Example with the bug::
Example with the bug::
...
@@ -184,7 +184,7 @@ Output in debug mode::
...
@@ -184,7 +184,7 @@ Output in debug mode::
File "test.py", line 7, in <module>
File "test.py", line 7, in <module>
test()
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.
:meth:`BaseEventLoop.create_task` method with the coroutine object.
.. seealso::
.. seealso::
...
...
Doc/library/asyncio-eventloop.rst
Dosyayı görüntüle @
04356e1f
...
@@ -36,7 +36,7 @@ Run an event loop
...
@@ -36,7 +36,7 @@ Run an event loop
Run until the :class:`Future` is done.
Run until the :class:`Future` is done.
If the argument is a :ref:`coroutine object <coroutine>`, it is wrapped by
If the argument is a :ref:`coroutine object <coroutine>`, it is wrapped by
:func:`
async
`.
:func:`
ensure_future
`.
Return the Future's result, or raise its exception.
Return the Future's result, or raise its exception.
...
...
Doc/library/asyncio-protocol.rst
Dosyayı görüntüle @
04356e1f
...
@@ -448,9 +448,9 @@ buffer size reaches the low-water mark.
...
@@ -448,9 +448,9 @@ buffer size reaches the low-water mark.
Coroutines and protocols
Coroutines and protocols
------------------------
------------------------
Coroutines can be scheduled in a protocol method using :func:`
async`, but there
Coroutines can be scheduled in a protocol method using :func:`
ensure_future`,
is no guarantee made about the execution order. Protocols are not aware of
but there is no guarantee made about the execution order. Protocols are not
coroutines created in protocol methods and so will not wait for them.
aware of
coroutines created in protocol methods and so will not wait for them.
To have a reliable execution order, use :ref:`stream objects <asyncio-streams>` in a
To have a reliable execution order, use :ref:`stream objects <asyncio-streams>` in a
coroutine with ``yield from``. For example, the :meth:`StreamWriter.drain`
coroutine with ``yield from``. For example, the :meth:`StreamWriter.drain`
...
...
Doc/library/asyncio-task.rst
Dosyayı görüntüle @
04356e1f
...
@@ -59,7 +59,7 @@ the coroutine object returned by the call doesn't do anything until you
...
@@ -59,7 +59,7 @@ the coroutine object returned by the call doesn't do anything until you
schedule its execution. There are two basic ways to start it running:
schedule its execution. There are two basic ways to start it running:
call ``await coroutine`` or ``yield from coroutine`` from another coroutine
call ``await coroutine`` or ``yield from coroutine`` from another coroutine
(assuming the other coroutine is already running!), or schedule its execution
(assuming the other coroutine is already running!), or schedule its execution
using the :func:`
async
` function or the :meth:`BaseEventLoop.create_task`
using the :func:`
ensure_future
` function or the :meth:`BaseEventLoop.create_task`
method.
method.
...
@@ -85,7 +85,7 @@ Coroutines (and tasks) can only run when the event loop is running.
...
@@ -85,7 +85,7 @@ Coroutines (and tasks) can only run when the event loop is running.
even if they are plain Python functions returning a :class:`Future`.
even if they are plain Python functions returning a :class:`Future`.
This is intentional to have a freedom of tweaking the implementation
This is intentional to have a freedom of tweaking the implementation
of these functions in the future. If such a function is needed to be
of these functions in the future. If such a function is needed to be
used in a callback-style code, wrap its result with :func:`
async
`.
used in a callback-style code, wrap its result with :func:`
ensure_future
`.
.. _asyncio-hello-world-coroutine:
.. _asyncio-hello-world-coroutine:
...
@@ -394,7 +394,7 @@ Task
...
@@ -394,7 +394,7 @@ Task
<coroutine>` did not complete. It is probably a bug and a warning is
<coroutine>` did not complete. It is probably a bug and a warning is
logged: see :ref:`Pending task destroyed <asyncio-pending-task-destroyed>`.
logged: see :ref:`Pending task destroyed <asyncio-pending-task-destroyed>`.
Don't directly create :class:`Task` instances: use the :func:`
async
`
Don't directly create :class:`Task` instances: use the :func:`
ensure_future
`
function or the :meth:`BaseEventLoop.create_task` method.
function or the :meth:`BaseEventLoop.create_task` method.
This class is :ref:`not thread safe <asyncio-multithreading>`.
This class is :ref:`not thread safe <asyncio-multithreading>`.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment