File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,15 @@ def _encode_collection_values(
165165 for i in range (count ):
166166 value = value_by_index [i ]
167167 result .append (str (len (value )))
168- for item in value :
168+ if isinstance (value , frozenset ):
169+ # even though frozensets are not sorted in python, we need to sort the items here
170+ # to improve the determinism of the generated C file, making it easier to compare
171+ # differences between compilation units.
172+ sort_keys_to_values = {str (v ): v for v in value }
173+ items = tuple (sort_keys_to - values [sort_key ] for sort_key in sorted (sort_keys_to_values ))
174+ else :
175+ items = value
176+ for item in items :
169177 assert _is_literal_value (item )
170178 index = self .literal_index (item )
171179 result .append (str (index ))
You can’t perform that action at this time.
0 commit comments