Nuitka version, full Python version and Platform (Windows, OSX, Linux ...)
0.6.7
Python: 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52)
OS: Darwin
Arch: x86_64
How did you install Nuitka and Python (pip, anaconda, deb, rpm, from source,
what is a virtualenv ...), this is very important usually.
pip
If possible please supply a Short, Self Contained, Correct, Example
that demonstrates the issue i.e a small piece of code which reproduces
the issue and can be run with out any other (or as few as possible)
external dependencies.
$ cat main.py
print(hash('hello'))
$ python -m nuitka main.py --standalone --python-flag=use_hash_seed
$ ./main.dist/main
-9128780370465225756
$ ./main.dist/main
-800855256429713425
These hash values should be the same. Setting PYTHONHASHSEED works:
$ PYTHONHASHSEED=1 ./main.dist/main
4134408098142180803
$ PYTHONHASHSEED=1 ./main.dist/main
4134408098142180803
Hello there,
seems this was falsely coded at the time, using another flag to control it. I am fixing it right now, but it will be a while until this can leave factory, as there must be minor version checks for the flag to even exist yet. I recall it was added in the middle of things.
Yours,
Kay
For Python2, setting the flag value does things after calling _PyRandom_Init only, for Python3 that flag seemingly has become write only, and a very complex mechanism appears to be used for init instead, using a data structure that is not easy to obtain and compose.
On factory there is a solution for this for non-Windows platforms:
https://nuitka.net/doc/factory.html
The handling of Environment variables needs abstraction. The way it turns out to be required is to mess with PYTHONHASHSEED during the initialization. So Nuitka now as a benefit also produces compiled binary which ignore this value with the option set, and still keep the environment variable for child processes to use.
Can confirm this works on mac. Thanks!
Will wait to close until you've solved Windows
This is now on develop, and going to be part of the next release. Works on Windows too.
The release 0.6.8 was just made and contains the correction.