commit | 83f5a3846cf67e226a13f103e0b9306e8f920f2e | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Tue Aug 23 09:39:03 2016 -0700 |
committer | Guido van Rossum <guido@python.org> | Tue Aug 23 09:39:03 2016 -0700 |
tree | e20b2641778035755e7d6d30ebcdf5162abe60eb | |
parent | 4b7b565c581f8f418df6e661ebf7d906794e7142 [diff] |
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 741aaf2..deefc93 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py
@@ -166,7 +166,7 @@ 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