[issue37596] Reproducible pyc: frozenset is not serialized in a deterministic order

Serhiy Storchaka report at bugs.python.org
Tue May 25 11:57:25 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Possible solution: add an ordered subtype of frozenset which would keep an array of items in the original order. The compiler only creates frozenset when optimizes "x in {1, 2}" or "for x in {1, 2}". It should now create an ordered frozenset from a list of constants (removing possible duplicates). The marshal module should save items in that order and restore ordered frozensets when load data. It should not increase memory consumption too much, because frozenset constants in code are rare and small.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37596>
_______________________________________


More information about the Python-bugs-list mailing list