From: Guido van Rossum Date: Tue, 23 Aug 2016 16:39:03 +0000 (-0700) Subject: In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self... X-Git-Tag: v3.6.0b1~584^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=83f5a3846cf67e226a13f103e0b9306e8f920f2e;p=thirdparty%2FPython%2Fcpython.git In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. --- diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index 741aaf27c5ee..deefc938ecfb 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