Skip to content

Commit 75fc8f6

Browse files
committed
Remove redundant checks for asyncio.CancelledError
1 parent d02f8fc commit 75fc8f6

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

redis/asyncio/connection.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ async def read_from_socket(
502502
# data was read from the socket and added to the buffer.
503503
# return True to indicate that data was read.
504504
return True
505-
except asyncio.CancelledError:
506-
raise
507505
except (socket.timeout, asyncio.TimeoutError):
508506
if raise_on_timeout:
509507
raise TimeoutError("Timeout reading from socket") from None
@@ -722,7 +720,7 @@ async def connect(self):
722720
lambda: self._connect(), lambda error: self.disconnect()
723721
)
724722
except asyncio.CancelledError:
725-
raise
723+
raise # in 3.7 and earlier, this is an Exception, not BaseException
726724
except (socket.timeout, asyncio.TimeoutError):
727725
raise TimeoutError("Timeout connecting to server")
728726
except OSError as e:

tests/test_asyncio/test_pubsub.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ async def loop_step_listen(self):
917917
except asyncio.TimeoutError:
918918
return False
919919

920-
920+
921921
@pytest.mark.onlynoncluster
922922
class TestBaseException:
923923
@pytest.mark.skipif(

0 commit comments

Comments
 (0)