From a051acae177d44da2460fc3b0f786ca598c70a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Thu, 23 Jun 2022 18:03:11 +0000 Subject: [PATCH] Remove redundant checks for asyncio.CancelledError --- redis/asyncio/connection.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 075c2a58bd..9d2419b89b 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -491,8 +491,6 @@ async def read_from_socket( # data was read from the socket and added to the buffer. # return True to indicate that data was read. return True - except asyncio.CancelledError: - raise except (socket.timeout, asyncio.TimeoutError): if raise_on_timeout: raise TimeoutError("Timeout reading from socket") from None @@ -711,7 +709,7 @@ async def connect(self): lambda: self._connect(), lambda error: self.disconnect() ) except asyncio.CancelledError: - raise + raise # in 3.7 and earlier, this is an Exception, not BaseException except (socket.timeout, asyncio.TimeoutError): raise TimeoutError("Timeout connecting to server") except OSError as e: