diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-01-09 19:41:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 19:41:31 (GMT) |
commit | a5db6a3351b440a875a5af84a8b2447981356e34 (patch) | |
tree | 1add2b8a6ef3511e9f2480d6bad8c48f5cdab768 /Lib/asyncio/timeouts.py | |
parent | 5273655bea050432756098641b9fda72361bf983 (diff) | |
download | cpython-a5db6a3351b440a875a5af84a8b2447981356e34.zip cpython-a5db6a3351b440a875a5af84a8b2447981356e34.tar.gz cpython-a5db6a3351b440a875a5af84a8b2447981356e34.tar.bz2 |
gh-113848: Handle CancelledError subclasses in asyncio TaskGroup() and timeout() (GH-113850)
Diffstat (limited to 'Lib/asyncio/timeouts.py')
-rw-r--r-- | Lib/asyncio/timeouts.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/asyncio/timeouts.py b/Lib/asyncio/timeouts.py index 30042ab..2c5dd29 100644 --- a/Lib/asyncio/timeouts.py +++ b/Lib/asyncio/timeouts.py @@ -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 |