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
a3160851
Kaydet (Commit)
a3160851
authored
May 31, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 24004: Support Awaitables (pep 492) in @asyncio.coroutine decorator
üst
03395687
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
coroutines.py
Lib/asyncio/coroutines.py
+13
-2
No files found.
Lib/asyncio/coroutines.py
Dosyayı görüntüle @
a3160851
...
@@ -54,9 +54,10 @@ else:
...
@@ -54,9 +54,10 @@ else:
inspect
.
CO_COROUTINE
)
inspect
.
CO_COROUTINE
)
try
:
try
:
from
collections.abc
import
Coroutine
as
CoroutineABC
from
collections.abc
import
Coroutine
as
CoroutineABC
,
\
Awaitable
as
AwaitableABC
except
ImportError
:
except
ImportError
:
CoroutineABC
=
None
CoroutineABC
=
AwaitableABC
=
None
# Check for CPython issue #21209
# Check for CPython issue #21209
...
@@ -192,6 +193,16 @@ def coroutine(func):
...
@@ -192,6 +193,16 @@ def coroutine(func):
res
=
func
(
*
args
,
**
kw
)
res
=
func
(
*
args
,
**
kw
)
if
isinstance
(
res
,
futures
.
Future
)
or
inspect
.
isgenerator
(
res
):
if
isinstance
(
res
,
futures
.
Future
)
or
inspect
.
isgenerator
(
res
):
res
=
yield
from
res
res
=
yield
from
res
elif
AwaitableABC
is
not
None
:
# If 'func' returns an Awaitable (new in 3.5) we
# want to run it.
try
:
await_meth
=
res
.
__await__
except
AttributeError
:
pass
else
:
if
isinstance
(
res
,
AwaitableABC
):
res
=
yield
from
await_meth
()
return
res
return
res
if
not
_DEBUG
:
if
not
_DEBUG
:
...
...
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