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 Sep 19, 2022
1 parent d02f8fc commit 75fc8f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions redis/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,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 @@ -722,7 +720,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
2 changes: 1 addition & 1 deletion tests/test_asyncio/test_pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ async def loop_step_listen(self):
except asyncio.TimeoutError:
return False


@pytest.mark.onlynoncluster
class TestBaseException:
@pytest.mark.skipif(
Expand Down

0 comments on commit 75fc8f6

Please sign in to comment.