diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py index 2c22c0e87b..362ddb8351 100644 --- a/redis/asyncio/connection.py +++ b/redis/asyncio/connection.py @@ -492,8 +492,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 @@ -708,7 +706,7 @@ async def connect(self): try: await self._connect() 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: