diff --git a/asyncio/locks.py b/asyncio/locks.py index 741aaf27..deefc938 100644 --- a/asyncio/locks.py +++ b/asyncio/locks.py @@ -166,7 +166,7 @@ def acquire(self): 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