summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-08-23 16:39:03 (GMT)
committerGuido van Rossum <guido@python.org>2016-08-23 16:39:03 (GMT)
commit83f5a3846cf67e226a13f103e0b9306e8f920f2e (patch)
treee20b2641778035755e7d6d30ebcdf5162abe60eb /Lib
parent4b7b565c581f8f418df6e661ebf7d906794e7142 (diff)
downloadcpython-83f5a3846cf67e226a13f103e0b9306e8f920f2e.zip
cpython-83f5a3846cf67e226a13f103e0b9306e8f920f2e.tar.gz
cpython-83f5a3846cf67e226a13f103e0b9306e8f920f2e.tar.bz2
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters.
Diffstat (limited to 'Lib')
-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 741aaf2..deefc93 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