Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always convert the sort key to an integer when sorting node names #292

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

ryanhamel
Copy link
Collaborator

Removes str vs int comparison bug by always converting the key to an integer. In this case, simply convert the string as bytes into an integer.

@@ -174,7 +174,7 @@ def _node_index_as_sort_key(nodename: str) -> Union[str, int]:
try:
return int(nodename.split("-")[-1])
except Exception:
return nodename
return int.from_bytes(nodename.encode(), byteorder="little")


def _node_index_and_pg_as_sort_key(nodename: str) -> Union[str, int]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the same change need to be applied in line 189 as well?

@aditigaur4
Copy link
Collaborator

I need to approve this for now to get the pre-release out but i think this PR might be incomplete.

@aditigaur4 aditigaur4 merged commit efd4f28 into master Nov 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants