[Python-checkins] cpython (merge 3.5 -> default): In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in
guido.van.rossum
python-checkins at python.org
Tue Aug 23 12:39:45 EDT 2016
https://hg.python.org/cpython/rev/2339eb860cba
changeset: 102861:2339eb860cba
parent: 102859:1017215f5492
parent: 102860:e3466a556d81
user: Guido van Rossum <guido at dropbox.com>
date: Tue Aug 23 09:39:26 2016 -0700
summary:
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. (Merge 3.5->3.6)
files:
Lib/asyncio/locks.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py
--- 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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list