Skip to content

Conversation

BobTheBuidler
Copy link
Contributor

This PR makes the process of encoding frozenset literals deterministic by sorting the items before encoding.

@BobTheBuidler BobTheBuidler changed the title [mypyc] feat: make frozenset literal compilation deterministic [mypyc] feat: make frozenset literal compilation deterministic [1/1] Oct 1, 2025
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

This is a good idea -- non-deterministic generated code is a significant problem.


def encoded_frozenset_values(self) -> list[str]:
return self._encode_collection_values(self.frozenset_literals)
def sort_frozenset_recursive(frozen: frozenset[object]) -> list[object]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe I move this even further up and sort them as they're added?

@BobTheBuidler BobTheBuidler marked this pull request as draft October 3, 2025 20:09
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