Skip to content

Commit c4f9e9f

Browse files
committed
Remove redundant checks for asyncio.CancelledError
1 parent 781388a commit c4f9e9f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

redis/asyncio/connection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,6 @@ async def read_from_socket(
492492
# data was read from the socket and added to the buffer.
493493
# return True to indicate that data was read.
494494
return True
495-
except asyncio.CancelledError:
496-
raise
497495
except (socket.timeout, asyncio.TimeoutError):
498496
if raise_on_timeout:
499497
raise TimeoutError("Timeout reading from socket") from None
@@ -708,7 +706,7 @@ async def connect(self):
708706
try:
709707
await self._connect()
710708
except asyncio.CancelledError:
711-
raise
709+
raise # in 3.7 and earlier, this is an Exception, not BaseException
712710
except (socket.timeout, asyncio.TimeoutError):
713711
raise TimeoutError("Timeout connecting to server")
714712
except OSError as e:

0 commit comments

Comments
 (0)