[Python-Dev] Deterministic builds of the interpreter

Freddy Rietdijk freddyrietdijk at fridh.nl
Sun Feb 19 06:35:13 EST 2017


Hi Armin,

Thank you for your explanation.

I've now managed to build 2.7 and 3.5 deterministic by recompiling the
bytecode at the end of the build (and excluding 2to3).

Freddy


On Sun, Feb 19, 2017 at 9:30 AM, Armin Rigo <armin.rigo at gmail.com> wrote:

> Hi Freddy,
>
> On 16 February 2017 at 18:03, Freddy Rietdijk <freddyrietdijk at fridh.nl>
> wrote:
> > As I mentioned, it seems only sets cause unreproducible
> > bytecode. Sets have no order. But when generating the bytecode, I would
> > expect there would still be an order since the code isn't actually
> executed,
> > right?
>
> No, the sets are built as real sets and then marshalled to .pyc files
> in a separate step.  So on CPython an essentially random order will
> end up in the .pyc file.  Even CPython 3.6 gives a deterministic order
> to dictionaries but not sets.  You could ensure sets are marshalled in
> a known order by changing the marshalling code, e.g. to emit them in
> sorted order (on Python 2.x; on 3.x it is more messy because different
> types are more often non-comparable).
>
>
> A bientôt,
>
> Armin.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170219/28448b6d/attachment.html>


More information about the Python-Dev mailing list