mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-32329: Fix -R option for hash randomization (#4873)
bpo-32329, bpo-32030: * The -R option now turns on hash randomization when the PYTHONHASHSEED environment variable is set to 0 Previously, the option was ignored. * sys.flags.hash_randomization is now properly set to 0 when hash randomization is turned off by PYTHONHASHSEED=0. * _PyCoreConfig_ReadEnv() now reads the PYTHONHASHSEED environment variable. _Py_HashRandomization_Init() now only apply the configuration, it doesn't read PYTHONHASHSEED anymore.
This commit is contained in:
parent
96a5e50a5d
commit
358e5e17a5
6 changed files with 63 additions and 39 deletions
|
@ -277,8 +277,9 @@ Miscellaneous options
|
|||
|
||||
.. cmdoption:: -R
|
||||
|
||||
Kept for compatibility. On Python 3.3 and greater, hash randomization is
|
||||
turned on by default.
|
||||
Turn on hash randomization. This option only has an effect if the
|
||||
:envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since hash
|
||||
randomization is enabled by default.
|
||||
|
||||
On previous versions of Python, this option turns on hash randomization,
|
||||
so that the :meth:`__hash__` values of str, bytes and datetime
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue