summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-02-21 02:44:56 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-02-21 02:44:56 (GMT)
commitaee9dfba4a9230f2832dd69d67e92f8e0490a163 (patch)
tree27a9896969ac7ff79dc75017cff121a077c3eb6e /Python/pythonrun.c
parent34b345b8885e5db8ab6627c081ca86a8b78b6989 (diff)
parentb19fb2462eac776746f6cb40cc84b0587c83b9bc (diff)
downloadcpython-aee9dfba4a9230f2832dd69d67e92f8e0490a163.zip
cpython-aee9dfba4a9230f2832dd69d67e92f8e0490a163.tar.gz
cpython-aee9dfba4a9230f2832dd69d67e92f8e0490a163.tar.bz2
merge 2.6 with hash randomization fix
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index bfb7fca..8e1cd623 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -67,6 +67,7 @@ static void call_sys_exitfunc(void);
static void call_ll_exitfuncs(void);
extern void _PyUnicode_Init(void);
extern void _PyUnicode_Fini(void);
+extern void _PyRandom_Init(void);
#ifdef WITH_THREAD
extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
@@ -89,6 +90,7 @@ int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
true divisions (which they will be in 2.3). */
int _Py_QnewFlag = 0;
int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
+int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
/* PyModule_GetWarningsModule is no longer necessary as of 2.6
since _warnings is builtin. This API should not be used. */
@@ -166,6 +168,12 @@ Py_InitializeEx(int install_sigs)
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);
+
+ _PyRandom_Init();
interp = PyInterpreterState_New();
if (interp == NULL)