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
a4afc487
Kaydet (Commit)
a4afc487
authored
Kas 16, 2015
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio: Optimize Task._wakeup
See
https://github.com/python/asyncio/pull/289
for details.
üst
1744d539
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
tasks.py
Lib/asyncio/tasks.py
+11
-2
No files found.
Lib/asyncio/tasks.py
Dosyayı görüntüle @
a4afc487
...
@@ -93,6 +93,7 @@ class Task(futures.Future):
...
@@ -93,6 +93,7 @@ class Task(futures.Future):
futures
.
Future
.
__del__
(
self
)
futures
.
Future
.
__del__
(
self
)
def
_repr_info
(
self
):
def
_repr_info
(
self
):
# Private method, do not use it.
info
=
super
()
.
_repr_info
()
info
=
super
()
.
_repr_info
()
if
self
.
_must_cancel
:
if
self
.
_must_cancel
:
...
@@ -221,6 +222,7 @@ class Task(futures.Future):
...
@@ -221,6 +222,7 @@ class Task(futures.Future):
return
True
return
True
def
_step
(
self
,
value
=
None
,
exc
=
None
):
def
_step
(
self
,
value
=
None
,
exc
=
None
):
# Private method, do not use it.
assert
not
self
.
done
(),
\
assert
not
self
.
done
(),
\
'_step(): already done: {!r}, {!r}, {!r}'
.
format
(
self
,
value
,
exc
)
'_step(): already done: {!r}, {!r}, {!r}'
.
format
(
self
,
value
,
exc
)
if
self
.
_must_cancel
:
if
self
.
_must_cancel
:
...
@@ -284,13 +286,20 @@ class Task(futures.Future):
...
@@ -284,13 +286,20 @@ class Task(futures.Future):
self
=
None
# Needed to break cycles when an exception occurs.
self
=
None
# Needed to break cycles when an exception occurs.
def
_wakeup
(
self
,
future
):
def
_wakeup
(
self
,
future
):
# Private method, do not use it.
try
:
try
:
value
=
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
(
None
,
exc
)
else
:
else
:
self
.
_step
(
value
,
None
)
# Don't pass the value of `future.result()` explicitly,
# as `Future.__iter__` and `Future.__await__` don't need it.
# If we call `_step(value, None)` instead of `_step()`,
# Python eval loop would use `.send(value)` method call,
# instead of `__next__()`, which is slower for futures
# that return non-generator iterators from their `__iter__`.
self
.
_step
()
self
=
None
# Needed to break cycles when an exception occurs.
self
=
None
# Needed to break cycles when an exception occurs.
...
...
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