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
9aa78566
Kaydet (Commit)
9aa78566
authored
Haz 05, 2019
tarafından
Zackery Spytz
Kaydeden (comit)
Miss Islington (bot)
Haz 05, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34767: Do not always create a collections.deque() in asyncio.Lock() (GH-13834)
https://bugs.python.org/issue34767
üst
d4cf099d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
locks.py
Lib/asyncio/locks.py
+7
-2
2019-06-04-23-44-52.bpo-34767.BpDShN.rst
...S.d/next/Library/2019-06-04-23-44-52.bpo-34767.BpDShN.rst
+1
-0
No files found.
Lib/asyncio/locks.py
Dosyayı görüntüle @
9aa78566
...
@@ -158,7 +158,7 @@ class Lock(_ContextManagerMixin):
...
@@ -158,7 +158,7 @@ class Lock(_ContextManagerMixin):
"""
"""
def
__init__
(
self
,
*
,
loop
=
None
):
def
__init__
(
self
,
*
,
loop
=
None
):
self
.
_waiters
=
collections
.
deque
()
self
.
_waiters
=
None
self
.
_locked
=
False
self
.
_locked
=
False
if
loop
is
not
None
:
if
loop
is
not
None
:
self
.
_loop
=
loop
self
.
_loop
=
loop
...
@@ -182,10 +182,13 @@ class Lock(_ContextManagerMixin):
...
@@ -182,10 +182,13 @@ class Lock(_ContextManagerMixin):
This method blocks until the lock is unlocked, then sets it to
This method blocks until the lock is unlocked, then sets it to
locked and returns True.
locked and returns True.
"""
"""
if
not
self
.
_locked
and
all
(
w
.
cancelled
()
for
w
in
self
.
_waiters
):
if
(
not
self
.
_locked
and
(
self
.
_waiters
is
None
or
all
(
w
.
cancelled
()
for
w
in
self
.
_waiters
))):
self
.
_locked
=
True
self
.
_locked
=
True
return
True
return
True
if
self
.
_waiters
is
None
:
self
.
_waiters
=
collections
.
deque
()
fut
=
self
.
_loop
.
create_future
()
fut
=
self
.
_loop
.
create_future
()
self
.
_waiters
.
append
(
fut
)
self
.
_waiters
.
append
(
fut
)
...
@@ -224,6 +227,8 @@ class Lock(_ContextManagerMixin):
...
@@ -224,6 +227,8 @@ class Lock(_ContextManagerMixin):
def
_wake_up_first
(
self
):
def
_wake_up_first
(
self
):
"""Wake up the first waiter if it isn't done."""
"""Wake up the first waiter if it isn't done."""
if
not
self
.
_waiters
:
return
try
:
try
:
fut
=
next
(
iter
(
self
.
_waiters
))
fut
=
next
(
iter
(
self
.
_waiters
))
except
StopIteration
:
except
StopIteration
:
...
...
Misc/NEWS.d/next/Library/2019-06-04-23-44-52.bpo-34767.BpDShN.rst
0 → 100644
Dosyayı görüntüle @
9aa78566
Do not always create a :class:`collections.deque` in :class:`asyncio.Lock`.
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