diff --git a/distributed/core.py b/distributed/core.py index df6d3cb8e99..ccc8da09e34 100644 --- a/distributed/core.py +++ b/distributed/core.py @@ -1544,6 +1544,8 @@ async def _connect(self, addr: str, timeout: float | None = None) -> Comm: self._connecting_count -= 1 except asyncio.CancelledError: current_task = asyncio.current_task() + if sys.version_info >= (3, 11): + current_task.uncancel() assert current_task reason = self._reasons.pop(current_task, "ConnectionPool closing.") raise CommClosedError(reason)