Skip to content

Commit 4af0924

Browse files
committed
Remove redundant checks for asyncio.CancelledError
1 parent 2bb618f commit 4af0924

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

redis/asyncio/connection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,6 @@ async def read_from_socket(
491491
# data was read from the socket and added to the buffer.
492492
# return True to indicate that data was read.
493493
return True
494-
except asyncio.CancelledError:
495-
raise
496494
except (socket.timeout, asyncio.TimeoutError):
497495
if raise_on_timeout:
498496
raise TimeoutError("Timeout reading from socket") from None
@@ -711,7 +709,7 @@ async def connect(self):
711709
lambda: self._connect(), lambda error: self.disconnect()
712710
)
713711
except asyncio.CancelledError:
714-
raise
712+
raise # in 3.7 and earlier, this is an Exception, not BaseException
715713
except (socket.timeout, asyncio.TimeoutError):
716714
raise TimeoutError("Timeout connecting to server")
717715
except OSError as e:

tests/test_asyncio/test_pubsub.py

Lines changed: 1 addition & 1 deletion
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)