summaryrefslogtreecommitdiff
path: root/Lib/asyncio/locks.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-08-23 09:39:03 -0700
committerGuido van Rossum <guido@python.org>2016-08-23 09:39:03 -0700
commit83f5a3846cf67e226a13f103e0b9306e8f920f2e (patch)
treee20b2641778035755e7d6d30ebcdf5162abe60eb /Lib/asyncio/locks.py
parent4b7b565c581f8f418df6e661ebf7d906794e7142 (diff)
downloadcpython-git-83f5a3846cf67e226a13f103e0b9306e8f920f2e.tar.gz
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters.
Diffstat (limited to 'Lib/asyncio/locks.py')
-rw-r--r--Lib/asyncio/locks.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py
index 741aaf27c5..deefc938ec 100644
--- a/Lib/asyncio/locks.py
+++ b/Lib/asyncio/locks.py
@@ -166,7 +166,7 @@ class Lock(_ContextManagerMixin):
This method blocks until the lock is unlocked, then sets it to
locked and returns True.
"""
- if not self._waiters and not self._locked:
+ if not self._locked and all(w.cancelled() for w in self._waiters):
self._locked = True
return True