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
996859a9
Unverified
Kaydet (Commit)
996859a9
authored
Eyl 25, 2018
tarafından
Yury Selivanov
Kaydeden (comit)
GitHub
Eyl 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34790: [docs] Passing coroutines to asyncio.wait() can be confusing. (GH-9543)
üst
22ef31d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
asyncio-task.rst
Doc/library/asyncio-task.rst
+36
-4
2018-09-24-12-47-08.bpo-34790.G2KXIH.rst
...xt/Documentation/2018-09-24-12-47-08.bpo-34790.G2KXIH.rst
+1
-0
No files found.
Doc/library/asyncio-task.rst
Dosyayı görüntüle @
996859a9
...
...
@@ -472,14 +472,20 @@ Waiting Primitives
return_when=ALL_COMPLETED)
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
se
quence
concurrently and block until the condition specified
se
t
concurrently and block until the condition specified
by *return_when*.
If any awaitable in *aws* is a coroutine, it is automatically
scheduled as a Task.
scheduled as a Task. Passing coroutines objects to
``wait()`` directly is deprecated as it leads to
:ref:`confusing behavior <asyncio_example_wait_coroutine>`.
Returns two sets of Tasks/Futures: ``(done, pending)``.
Usage::
done, pending = await asyncio.wait(aws)
The *loop* argument is deprecated and scheduled for removal
in Python 4.0.
...
...
@@ -514,9 +520,35 @@ Waiting Primitives
Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the
futures when a timeout occurs.
Usage::
.. _asyncio_example_wait_coroutine:
.. note::
done, pending = await asyncio.wait(aws)
``wait()`` schedules coroutines as Tasks automatically and later
returns those implicitly created Task objects in ``(done, pending)``
sets. Therefore the following code won't work as expected::
async def foo():
return 42
coro = foo()
done, pending = await asyncio.wait({coro})
if coro in done:
# This branch will never be run!
Here is how the above snippet can be fixed::
async def foo():
return 42
task = asyncio.create_task(foo())
done, pending = await asyncio.wait({task})
if task in done:
# Everything will work as expected now.
Passing coroutine objects to ``wait()`` directly is
deprecated.
.. function:: as_completed(aws, \*, loop=None, timeout=None)
...
...
Misc/NEWS.d/next/Documentation/2018-09-24-12-47-08.bpo-34790.G2KXIH.rst
0 → 100644
Dosyayı görüntüle @
996859a9
Document how passing coroutines to asyncio.wait() can be confusing.
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