comparison Python/pythonrun.c @ 75102:a0f43f4481e0 2.7

merge 2.6 with hash randomization fix
author Benjamin Peterson <benjamin@python.org>
date Mon, 20 Feb 2012 21:44:56 -0500
parents 97a75fccd7c8 6b7704fe1be1
children 0abffbe7cf22
comparison
equal deleted inserted replaced
75072:2e8b28dbc395 75102:a0f43f4481e0
65 static void wait_for_thread_shutdown(void); 65 static void wait_for_thread_shutdown(void);
66 static void call_sys_exitfunc(void); 66 static void call_sys_exitfunc(void);
67 static void call_ll_exitfuncs(void); 67 static void call_ll_exitfuncs(void);
68 extern void _PyUnicode_Init(void); 68 extern void _PyUnicode_Init(void);
69 extern void _PyUnicode_Fini(void); 69 extern void _PyUnicode_Fini(void);
70 extern void _PyRandom_Init(void);
70 71
71 #ifdef WITH_THREAD 72 #ifdef WITH_THREAD
72 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); 73 extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
73 extern void _PyGILState_Fini(void); 74 extern void _PyGILState_Fini(void);
74 #endif /* WITH_THREAD */ 75 #endif /* WITH_THREAD */
87 /* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed, 88 /* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed,
88 on the command line, and is used in 2.2 by ceval.c to make all "/" divisions 89 on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
89 true divisions (which they will be in 2.3). */ 90 true divisions (which they will be in 2.3). */
90 int _Py_QnewFlag = 0; 91 int _Py_QnewFlag = 0;
91 int Py_NoUserSiteDirectory = 0; /* for -s and site.py */ 92 int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
93 int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
92 94
93 /* PyModule_GetWarningsModule is no longer necessary as of 2.6 95 /* PyModule_GetWarningsModule is no longer necessary as of 2.6
94 since _warnings is builtin. This API should not be used. */ 96 since _warnings is builtin. This API should not be used. */
95 PyObject * 97 PyObject *
96 PyModule_GetWarningsModule(void) 98 PyModule_GetWarningsModule(void)
164 Py_VerboseFlag = add_flag(Py_VerboseFlag, p); 166 Py_VerboseFlag = add_flag(Py_VerboseFlag, p);
165 if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') 167 if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
166 Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); 168 Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
167 if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0') 169 if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
168 Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p); 170 Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
171 /* The variable is only tested for existence here; _PyRandom_Init will
172 check its value further. */
173 if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
174 Py_HashRandomizationFlag = add_flag(Py_HashRandomizationFlag, p);
175
176 _PyRandom_Init();
169 177
170 interp = PyInterpreterState_New(); 178 interp = PyInterpreterState_New();
171 if (interp == NULL) 179 if (interp == NULL)
172 Py_FatalError("Py_Initialize: can't make first interpreter"); 180 Py_FatalError("Py_Initialize: can't make first interpreter");
173 181