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
dce63234
Kaydet (Commit)
dce63234
authored
Mar 02, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Fix @coroutine to recognize CoroWrapper (issue #25647)
Patch by Vladimir Rutsky.
üst
0c6a3440
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
coroutines.py
Lib/asyncio/coroutines.py
+2
-1
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+24
-0
No files found.
Lib/asyncio/coroutines.py
Dosyayı görüntüle @
dce63234
...
@@ -204,7 +204,8 @@ def coroutine(func):
...
@@ -204,7 +204,8 @@ def coroutine(func):
@functools.wraps
(
func
)
@functools.wraps
(
func
)
def
coro
(
*
args
,
**
kw
):
def
coro
(
*
args
,
**
kw
):
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
)
or
\
isinstance
(
res
,
CoroWrapper
):
res
=
yield
from
res
res
=
yield
from
res
elif
_AwaitableABC
is
not
None
:
elif
_AwaitableABC
is
not
None
:
# If 'func' returns an Awaitable (new in 3.5) we
# If 'func' returns an Awaitable (new in 3.5) we
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
dce63234
...
@@ -1794,6 +1794,30 @@ class TaskTests(test_utils.TestCase):
...
@@ -1794,6 +1794,30 @@ class TaskTests(test_utils.TestCase):
self
.
assertRegex
(
message
,
re
.
compile
(
regex
,
re
.
DOTALL
))
self
.
assertRegex
(
message
,
re
.
compile
(
regex
,
re
.
DOTALL
))
def
test_return_coroutine_from_coroutine
(
self
):
"""Return of @asyncio.coroutine()-wrapped function generator object
from @asyncio.coroutine()-wrapped function should have same effect as
returning generator object or Future."""
def
check
():
@asyncio.coroutine
def
outer_coro
():
@asyncio.coroutine
def
inner_coro
():
return
1
return
inner_coro
()
result
=
self
.
loop
.
run_until_complete
(
outer_coro
())
self
.
assertEqual
(
result
,
1
)
# Test with debug flag cleared.
with
set_coroutine_debug
(
False
):
check
()
# Test with debug flag set.
with
set_coroutine_debug
(
True
):
check
()
def
test_task_source_traceback
(
self
):
def
test_task_source_traceback
(
self
):
self
.
loop
.
set_debug
(
True
)
self
.
loop
.
set_debug
(
True
)
...
...
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