diff options
author | Yury Selivanov <yury@magic.io> | 2016-06-11 16:00:07 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2016-06-11 16:00:07 (GMT) |
commit | c92bf83a829956e683a3d6bb1ae65aed74d7b92a (patch) | |
tree | fee9f36c8042a41f709a3916baabfa95d91ad1cb /Lib/asyncio/locks.py | |
parent | ca2e0a48cf0dd663ba7457dc6bce60988cdfd56c (diff) | |
download | cpython-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/locks.py')
-rw-r--r-- | Lib/asyncio/locks.py | 8 |
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): |