diff options
author | Guido van Rossum <guido@dropbox.com> | 2016-08-23 16:39:26 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@dropbox.com> | 2016-08-23 16:39:26 (GMT) |
commit | f06c7b6f377692b82f2da449cb7e9460f474f434 (patch) | |
tree | 3abf1d652a4c1fd16f09f2440f3e5e24a9ca967b /Lib/asyncio | |
parent | 4fe9f163af895c980a3d36417b11484808e7e600 (diff) | |
parent | 83f5a3846cf67e226a13f103e0b9306e8f920f2e (diff) | |
download | cpython-f06c7b6f377692b82f2da449cb7e9460f474f434.zip cpython-f06c7b6f377692b82f2da449cb7e9460f474f434.tar.gz cpython-f06c7b6f377692b82f2da449cb7e9460f474f434.tar.bz2 |
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. (Merge 3.5->3.6)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r-- | Lib/asyncio/locks.py | 2 |
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 |