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
d59bba88
Kaydet (Commit)
d59bba88
authored
Kas 20, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Drop "value" parameter from Task._step method.
üst
b485bb41
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
tasks.py
Lib/asyncio/tasks.py
+12
-10
No files found.
Lib/asyncio/tasks.py
Dosyayı görüntüle @
d59bba88
...
@@ -220,9 +220,9 @@ class Task(futures.Future):
...
@@ -220,9 +220,9 @@ class Task(futures.Future):
self
.
_must_cancel
=
True
self
.
_must_cancel
=
True
return
True
return
True
def
_step
(
self
,
value
=
None
,
exc
=
None
):
def
_step
(
self
,
exc
=
None
):
assert
not
self
.
done
(),
\
assert
not
self
.
done
(),
\
'_step(): already done: {!r}, {!r}
, {!r}'
.
format
(
self
,
value
,
exc
)
'_step(): already done: {!r}, {!r}
'
.
format
(
self
,
exc
)
if
self
.
_must_cancel
:
if
self
.
_must_cancel
:
if
not
isinstance
(
exc
,
futures
.
CancelledError
):
if
not
isinstance
(
exc
,
futures
.
CancelledError
):
exc
=
futures
.
CancelledError
()
exc
=
futures
.
CancelledError
()
...
@@ -231,12 +231,14 @@ class Task(futures.Future):
...
@@ -231,12 +231,14 @@ class Task(futures.Future):
self
.
_fut_waiter
=
None
self
.
_fut_waiter
=
None
self
.
__class__
.
_current_tasks
[
self
.
_loop
]
=
self
self
.
__class__
.
_current_tasks
[
self
.
_loop
]
=
self
# Call either coro.throw(exc) or coro.send(
valu
e).
# Call either coro.throw(exc) or coro.send(
Non
e).
try
:
try
:
if
exc
is
not
None
:
if
exc
is
None
:
result
=
coro
.
throw
(
exc
)
# We use the `send` method directly, because coroutines
# don't have `__iter__` and `__next__` methods.
result
=
coro
.
send
(
None
)
else
:
else
:
result
=
coro
.
send
(
value
)
result
=
coro
.
throw
(
exc
)
except
StopIteration
as
exc
:
except
StopIteration
as
exc
:
self
.
set_result
(
exc
.
value
)
self
.
set_result
(
exc
.
value
)
except
futures
.
CancelledError
as
exc
:
except
futures
.
CancelledError
as
exc
:
...
@@ -258,7 +260,7 @@ class Task(futures.Future):
...
@@ -258,7 +260,7 @@ class Task(futures.Future):
self
.
_must_cancel
=
False
self
.
_must_cancel
=
False
else
:
else
:
self
.
_loop
.
call_soon
(
self
.
_loop
.
call_soon
(
self
.
_step
,
None
,
self
.
_step
,
RuntimeError
(
RuntimeError
(
'yield was used instead of yield from '
'yield was used instead of yield from '
'in task {!r} with {!r}'
.
format
(
self
,
result
)))
'in task {!r} with {!r}'
.
format
(
self
,
result
)))
...
@@ -268,7 +270,7 @@ class Task(futures.Future):
...
@@ -268,7 +270,7 @@ class Task(futures.Future):
elif
inspect
.
isgenerator
(
result
):
elif
inspect
.
isgenerator
(
result
):
# Yielding a generator is just wrong.
# Yielding a generator is just wrong.
self
.
_loop
.
call_soon
(
self
.
_loop
.
call_soon
(
self
.
_step
,
None
,
self
.
_step
,
RuntimeError
(
RuntimeError
(
'yield was used instead of yield from for '
'yield was used instead of yield from for '
'generator in task {!r} with {}'
.
format
(
'generator in task {!r} with {}'
.
format
(
...
@@ -276,7 +278,7 @@ class Task(futures.Future):
...
@@ -276,7 +278,7 @@ class Task(futures.Future):
else
:
else
:
# Yielding something else is an error.
# Yielding something else is an error.
self
.
_loop
.
call_soon
(
self
.
_loop
.
call_soon
(
self
.
_step
,
None
,
self
.
_step
,
RuntimeError
(
RuntimeError
(
'Task got bad yield: {!r}'
.
format
(
result
)))
'Task got bad yield: {!r}'
.
format
(
result
)))
finally
:
finally
:
...
@@ -288,7 +290,7 @@ class Task(futures.Future):
...
@@ -288,7 +290,7 @@ class Task(futures.Future):
future
.
result
()
future
.
result
()
except
Exception
as
exc
:
except
Exception
as
exc
:
# This may also be a cancellation.
# This may also be a cancellation.
self
.
_step
(
None
,
exc
)
self
.
_step
(
exc
)
else
:
else
:
# Don't pass the value of `future.result()` explicitly,
# Don't pass the value of `future.result()` explicitly,
# as `Future.__iter__` and `Future.__await__` don't need it.
# as `Future.__iter__` and `Future.__await__` don't need it.
...
...
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