From c4f9e9f4c1101862e5ce026e2b22e4192287c267 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 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: