-
Notifications
You must be signed in to change notification settings - Fork 168
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
Cloudpickle non-deterministic dump when file is innocuously modified #385
Comments
Thanks for your report. What you're reporting seems plausible, but I cannot reproduce on my machine (Ubuntu 18, Python 3.6, same cloudpickle version)... |
For me, inserting a blank line changes the hash both for cloudpickle and dill. But the hash stays consistent across runs without code change. |
Anyway, having deterministic pickles is probably out of scope for cloudpickle so I would be in favor of closing this issue. |
Cloudpickle seems to produce non-deterministic dumps when the file's formatting is "innocuously" modified (e.g., formatting changes outside of pickled object's definition) whereas
dill
andpickle
would produce deterministic dumps.For example, inserting a blank line anywhere after where the pickled function
foo
is defined will initially produce a different hash, then subsequently produce the same hash upon successive runs:Command:
First run:
Second run:
Blank line inserted after
print('Cpickle:', ...)
(third run):Fourth run:
This was tested on the following versions:
This seems like perhaps Cloudpickle is also hashing some eventually cached version of the source file (e.g., .pyc).
This is also somewhat related to #120 .
The text was updated successfully, but these errors were encountered: