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
27182bb2
Kaydet (Commit)
27182bb2
authored
Kas 15, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5 (issue #28703)
üst
63859aea
0ed20cdf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
coroutines.py
Lib/asyncio/coroutines.py
+14
-2
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+2
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/asyncio/coroutines.py
Dosyayı görüntüle @
27182bb2
...
...
@@ -33,12 +33,16 @@ _DEBUG = (not sys.flags.ignore_environment and
try
:
_types_coroutine
=
types
.
coroutine
_types_CoroutineType
=
types
.
CoroutineType
except
AttributeError
:
# Python 3.4
_types_coroutine
=
None
_types_CoroutineType
=
None
try
:
_inspect_iscoroutinefunction
=
inspect
.
iscoroutinefunction
except
AttributeError
:
# Python 3.4
_inspect_iscoroutinefunction
=
lambda
func
:
False
try
:
...
...
@@ -238,19 +242,27 @@ def coroutine(func):
w
.
__qualname__
=
getattr
(
func
,
'__qualname__'
,
None
)
return
w
wrapper
.
_is_coroutine
=
Tru
e
# For iscoroutinefunction().
wrapper
.
_is_coroutine
=
_is_coroutin
e
# For iscoroutinefunction().
return
wrapper
# A marker for iscoroutinefunction.
_is_coroutine
=
object
()
def
iscoroutinefunction
(
func
):
"""Return True if func is a decorated coroutine function."""
return
(
getattr
(
func
,
'_is_coroutine'
,
False
)
or
return
(
getattr
(
func
,
'_is_coroutine'
,
None
)
is
_is_coroutine
or
_inspect_iscoroutinefunction
(
func
))
_COROUTINE_TYPES
=
(
types
.
GeneratorType
,
CoroWrapper
)
if
_CoroutineABC
is
not
None
:
_COROUTINE_TYPES
+=
(
_CoroutineABC
,)
if
_types_CoroutineType
is
not
None
:
# Prioritize native coroutine check to speed-up
# asyncio.iscoroutine.
_COROUTINE_TYPES
=
(
_types_CoroutineType
,)
+
_COROUTINE_TYPES
def
iscoroutine
(
obj
):
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
27182bb2
...
...
@@ -1390,6 +1390,8 @@ class BaseTaskTests:
yield
self
.
assertTrue
(
asyncio
.
iscoroutinefunction
(
fn2
))
self
.
assertFalse
(
asyncio
.
iscoroutinefunction
(
mock
.
Mock
()))
def
test_yield_vs_yield_from
(
self
):
fut
=
self
.
new_future
(
self
.
loop
)
...
...
Misc/NEWS
Dosyayı görüntüle @
27182bb2
...
...
@@ -58,6 +58,8 @@ Library
-
Issue
#
28653
:
Fix
a
refleak
in
functools
.
lru_cache
.
-
Issue
#
28703
:
Fix
asyncio
.
iscoroutinefunction
to
handle
Mock
objects
.
Documentation
-------------
...
...
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