mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
bpo-34622: Extract asyncio exceptions into a separate module (GH-9141)
This commit is contained in:
parent
7c7605ff11
commit
0baa72f4b2
18 changed files with 148 additions and 110 deletions
|
@ -7,6 +7,7 @@ import warnings
|
|||
|
||||
from . import events
|
||||
from . import futures
|
||||
from . import exceptions
|
||||
from .coroutines import coroutine
|
||||
|
||||
|
||||
|
@ -192,7 +193,7 @@ class Lock(_ContextManagerMixin):
|
|||
await fut
|
||||
finally:
|
||||
self._waiters.remove(fut)
|
||||
except futures.CancelledError:
|
||||
except exceptions.CancelledError:
|
||||
if not self._locked:
|
||||
self._wake_up_first()
|
||||
raise
|
||||
|
@ -363,11 +364,11 @@ class Condition(_ContextManagerMixin):
|
|||
try:
|
||||
await self.acquire()
|
||||
break
|
||||
except futures.CancelledError:
|
||||
except exceptions.CancelledError:
|
||||
cancelled = True
|
||||
|
||||
if cancelled:
|
||||
raise futures.CancelledError
|
||||
raise exceptions.CancelledError
|
||||
|
||||
async def wait_for(self, predicate):
|
||||
"""Wait until a predicate becomes true.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue