From 83f5a3846cf67e226a13f103e0b9306e8f920f2e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 23 Aug 2016 09:39:03 -0700 Subject: In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. --- Lib/asyncio/locks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v0.12