mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-113848: Handle CancelledError subclasses in asyncio TaskGroup() and timeout() (GH-113850)
This commit is contained in:
parent
5273655bea
commit
a5db6a3351
3 changed files with 13 additions and 7 deletions
|
|
@ -109,10 +109,11 @@ class Timeout:
|
|||
if self._state is _State.EXPIRING:
|
||||
self._state = _State.EXPIRED
|
||||
|
||||
if self._task.uncancel() <= self._cancelling and exc_type is exceptions.CancelledError:
|
||||
# Since there are no new cancel requests, we're
|
||||
# handling this.
|
||||
raise TimeoutError from exc_val
|
||||
if self._task.uncancel() <= self._cancelling and exc_type is not None:
|
||||
if issubclass(exc_type, exceptions.CancelledError):
|
||||
# Since there are no new cancel requests, we're
|
||||
# handling this.
|
||||
raise TimeoutError from exc_val
|
||||
elif self._state is _State.ENTERED:
|
||||
self._state = _State.EXITED
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue