Skip to content

Commit

Permalink
Remove redundant checks for asyncio.CancelledError
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur committed Jul 27, 2022
1 parent 2bb618f commit a051aca
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a051aca

Please sign in to comment.