Copilot commented on code in PR #1300:
URL:
https://github.com/apache/cassandra-python-driver/pull/1300#discussion_r3599201625
##########
cassandra/connection.py:
##########
@@ -282,16 +281,16 @@ def _resolve_proxy_addresses(self):
socket.AF_UNSPEC, socket.SOCK_STREAM)
def __eq__(self, other):
- return (isinstance(other, SniEndPoint) and
- self.address == other.address and self.port == other.port and
- self._server_name == other._server_name)
+ return (isinstance(other, SniEndPoint)
+ and self.address == other.address and self.port == other.port
+ and self._server_name == other._server_name)
def __hash__(self):
return hash((self.address, self.port, self._server_name))
def __lt__(self, other):
- return ((self.address, self.port, self._server_name) <
- (other.address, other.port, self._server_name))
+ return ((self.address, self.port, self._server_name)
+ < (other.address, other.port, self._server_name))
Review Comment:
`SniEndPoint.__lt__` compares against a tuple that uses `self._server_name`
on both sides, so ordering ignores `other._server_name` and can violate
antisymmetry/total ordering when server names differ. This can lead to
inconsistent sorting behavior for endpoints with the same address/port but
different SNI names.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]