summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-06-11 16:00:07 (GMT)
committerYury Selivanov <yury@magic.io>2016-06-11 16:00:07 (GMT)
commitc92bf83a829956e683a3d6bb1ae65aed74d7b92a (patch)
treefee9f36c8042a41f709a3916baabfa95d91ad1cb /Lib/asyncio
parentca2e0a48cf0dd663ba7457dc6bce60988cdfd56c (diff)
downloadcpython-c92bf83a829956e683a3d6bb1ae65aed74d7b92a.zip
cpython-c92bf83a829956e683a3d6bb1ae65aed74d7b92a.tar.gz
cpython-c92bf83a829956e683a3d6bb1ae65aed74d7b92a.tar.bz2
Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait.
Patch by David Coles.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/locks.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py
index 842d621..741aaf2 100644
--- a/Lib/asyncio/locks.py
+++ b/Lib/asyncio/locks.py
@@ -329,7 +329,13 @@ class Condition(_ContextManagerMixin):
self._waiters.remove(fut)
finally:
- yield from self.acquire()
+ # Must reacquire lock even if wait is cancelled
+ while True:
+ try:
+ yield from self.acquire()
+ break
+ except futures.CancelledError:
+ pass
@coroutine
def wait_for(self, predicate):