Irit Katriel added the comment:
This is working now (note that since 3.10 hash randomisation is enabled by
default):
cpython % export PYTHONHASHSEED=random
cpython % ./python.exe -c "import sys; print(sys.flags.hash_randomization)"
1
cpython % export PYTHONHASHSEED=0
Changes by Christian Heimes li...@cheimes.de:
--
nosy: +christian.heimes
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17708
___
___
Changes by Benjamin Peterson benja...@python.org:
--
nosy: +dmalcolm
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17708
___
___
Python-bugs-list
Stephen Tu added the comment:
Py_HashRandomizationFlag was not getting properly set anywhere. This patch
fixes this. Also a test case
Behavior is now:
$ cat ~/hr.py
import sys
print(sys.flags.hash_randomization)
$ PYTHONHASHSEED=random ./python.exe ~/hr.py
1
$ PYTHONHASHSEED=0 ./python.exe
Masami HIRATA added the comment:
It seems there is a misunderstanding on my part.
Python v3.3.1 documentation says,
sys.flags The struct sequence flags exposes the status of command line flags.
The attributes are read only.
I think that sys.flags.hash_randomization should be always 1 on
Stephen Tu added the comment:
But it would seem that setting PYTHONHASHSEED != random does disable hash
randomization. also, not sure what the semantics of the following is:
$ PYTHONHASHSEED=1 python -R ...
right now, python3 basically ignores -R.
--
Masami HIRATA added the comment:
We should add 'randomization' and 'seed' attribute to sys.hash_info, I think.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17708
___
New submission from Masami HIRATA:
OS: Windows 7 Starter Edition SP1 (32-bit)
Python: 3.3.1 (python-3.3.1.msi)
It seems that sys.flags.hash_randomization doesn't return correct value
Output:
C:\set PYTHONHASHSEED=random
C:\C:\Python33\python.exe
Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013,