diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pylifecycle.c | 4 | ||||
-rw-r--r-- | Python/random.c | 3 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 640271f..ecfdfee 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -330,10 +330,6 @@ _Py_InitializeEx_Private(int install_sigs, int install_importlib) Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0') Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p); - /* The variable is only tested for existence here; _PyRandom_Init will - check its value further. */ - if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0') - Py_HashRandomizationFlag = add_flag(Py_HashRandomizationFlag, p); #ifdef MS_WINDOWS if ((p = Py_GETENV("PYTHONLEGACYWINDOWSFSENCODING")) && *p != '\0') Py_LegacyWindowsFSEncodingFlag = add_flag(Py_LegacyWindowsFSEncodingFlag, p); diff --git a/Python/random.c b/Python/random.c index c97d5e7..e0ee153 100644 --- a/Python/random.c +++ b/Python/random.c @@ -565,9 +565,11 @@ _PyRandom_Init(void) if (seed == 0) { /* disable the randomized hash */ memset(secret, 0, secret_size); + Py_HashRandomizationFlag = 0; } else { lcg_urandom(seed, secret, secret_size); + Py_HashRandomizationFlag = 1; } } else { @@ -582,6 +584,7 @@ _PyRandom_Init(void) if (res < 0) { Py_FatalError("failed to get random numbers to initialize Python"); } + Py_HashRandomizationFlag = 1; } } |