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
89d3f53a
Kaydet (Commit)
89d3f53a
authored
Nis 01, 2016
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5 (asyncio)
üst
dcfebb32
2ba8ece5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
tasks.py
Lib/asyncio/tasks.py
+8
-6
test_tasks.py
Lib/test/test_asyncio/test_tasks.py
+16
-0
overlapped.c
Modules/overlapped.c
+6
-0
No files found.
Lib/asyncio/tasks.py
Dosyayı görüntüle @
89d3f53a
...
@@ -401,7 +401,7 @@ def wait_for(fut, timeout, *, loop=None):
...
@@ -401,7 +401,7 @@ def wait_for(fut, timeout, *, loop=None):
@coroutine
@coroutine
def
_wait
(
fs
,
timeout
,
return_when
,
loop
):
def
_wait
(
fs
,
timeout
,
return_when
,
loop
):
"""Internal helper for wait() and
_
wait_for().
"""Internal helper for wait() and wait_for().
The fs argument must be a collection of Futures.
The fs argument must be a collection of Futures.
"""
"""
...
@@ -747,7 +747,7 @@ def timeout(timeout, *, loop=None):
...
@@ -747,7 +747,7 @@ def timeout(timeout, *, loop=None):
... yield from coro()
... yield from coro()
timeout: timeout value in seconds
timeout: timeout value in seconds
or None to disable timeout logic
loop: asyncio compatible event loop
loop: asyncio compatible event loop
"""
"""
if
loop
is
None
:
if
loop
is
None
:
...
@@ -768,8 +768,9 @@ class _Timeout:
...
@@ -768,8 +768,9 @@ class _Timeout:
if
self
.
_task
is
None
:
if
self
.
_task
is
None
:
raise
RuntimeError
(
'Timeout context manager should be used '
raise
RuntimeError
(
'Timeout context manager should be used '
'inside a task'
)
'inside a task'
)
self
.
_cancel_handler
=
self
.
_loop
.
call_later
(
if
self
.
_timeout
is
not
None
:
self
.
_timeout
,
self
.
_cancel_task
)
self
.
_cancel_handler
=
self
.
_loop
.
call_later
(
self
.
_timeout
,
self
.
_cancel_task
)
return
self
return
self
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
def
__exit__
(
self
,
exc_type
,
exc_val
,
exc_tb
):
...
@@ -777,8 +778,9 @@ class _Timeout:
...
@@ -777,8 +778,9 @@ class _Timeout:
self
.
_cancel_handler
=
None
self
.
_cancel_handler
=
None
self
.
_task
=
None
self
.
_task
=
None
raise
futures
.
TimeoutError
raise
futures
.
TimeoutError
self
.
_cancel_handler
.
cancel
()
if
self
.
_timeout
is
not
None
:
self
.
_cancel_handler
=
None
self
.
_cancel_handler
.
cancel
()
self
.
_cancel_handler
=
None
self
.
_task
=
None
self
.
_task
=
None
def
_cancel_task
(
self
):
def
_cancel_task
(
self
):
...
...
Lib/test/test_asyncio/test_tasks.py
Dosyayı görüntüle @
89d3f53a
...
@@ -2382,6 +2382,22 @@ class TimeoutTests(test_utils.TestCase):
...
@@ -2382,6 +2382,22 @@ class TimeoutTests(test_utils.TestCase):
self
.
loop
.
run_until_complete
(
go
())
self
.
loop
.
run_until_complete
(
go
())
def
test_timeout_disable
(
self
):
@asyncio.coroutine
def
long_running_task
():
yield
from
asyncio
.
sleep
(
0.1
,
loop
=
self
.
loop
)
return
'done'
@asyncio.coroutine
def
go
():
t0
=
self
.
loop
.
time
()
with
asyncio
.
timeout
(
None
,
loop
=
self
.
loop
):
resp
=
yield
from
long_running_task
()
self
.
assertEqual
(
resp
,
'done'
)
dt
=
self
.
loop
.
time
()
-
t0
self
.
assertTrue
(
0.09
<
dt
<
0.11
,
dt
)
self
.
loop
.
run_until_complete
(
go
())
def
test_raise_runtimeerror_if_no_task
(
self
):
def
test_raise_runtimeerror_if_no_task
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
with
self
.
assertRaises
(
RuntimeError
):
with
asyncio
.
timeout
(
0.1
,
loop
=
self
.
loop
):
with
asyncio
.
timeout
(
0.1
,
loop
=
self
.
loop
):
...
...
Modules/overlapped.c
Dosyayı görüntüle @
89d3f53a
...
@@ -23,6 +23,12 @@
...
@@ -23,6 +23,12 @@
# define T_POINTER T_ULONGLONG
# define T_POINTER T_ULONGLONG
#endif
#endif
/* Compatibility with Python 3.3 */
#if PY_VERSION_HEX < 0x03040000
# define PyMem_RawMalloc PyMem_Malloc
# define PyMem_RawFree PyMem_Free
#endif
#define F_HANDLE F_POINTER
#define F_HANDLE F_POINTER
#define F_ULONG_PTR F_POINTER
#define F_ULONG_PTR F_POINTER
#define F_DWORD "k"
#define F_DWORD "k"
...
...
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