diff options
author | Bar Harel <bzvi7919@gmail.com> | 2018-02-14 09:18:11 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-02-14 09:18:11 (GMT) |
commit | 5746510b7aef423fa4afc92b2abb919307b1dbb9 (patch) | |
tree | f8eb94a5cffea013abdab3f86b09abe46de6cd43 /Lib/asyncio/locks.py | |
parent | 3384d38d51a2c3450e742175db5d6d638fa5d2eb (diff) | |
download | cpython-5746510b7aef423fa4afc92b2abb919307b1dbb9.zip cpython-5746510b7aef423fa4afc92b2abb919307b1dbb9.tar.gz cpython-5746510b7aef423fa4afc92b2abb919307b1dbb9.tar.bz2 |
bpo-32841: Fix cancellation in awaiting asyncio.Condition (#5665)
Diffstat (limited to 'Lib/asyncio/locks.py')
-rw-r--r-- | Lib/asyncio/locks.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index 508a214..91f7a01 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -358,12 +358,16 @@ class Condition(_ContextManagerMixin): finally: # Must reacquire lock even if wait is cancelled + cancelled = False while True: try: await self.acquire() break except futures.CancelledError: - pass + cancelled = True + + if cancelled: + raise futures.CancelledError async def wait_for(self, predicate): """Wait until a predicate becomes true. |