Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(216)

Unified Diff: Python/pythonrun.c

Issue 13704: Random number generator in Python core
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Python/pythonrun.c Fri Dec 30 21:26:08 2011 +0100
+++ b/Python/pythonrun.c Tue Jan 03 21:48:43 2012 +0100
@@ -73,6 +73,7 @@
extern void PyLong_Fini(void);
extern int _PyFaulthandler_Init(void);
extern void _PyFaulthandler_Fini(void);
+extern void _Py_InitRndHashSeed(void);
#ifdef WITH_THREAD
extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
@@ -92,9 +93,11 @@
int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
int Py_UnbufferedStdioFlag = 0; /* Unbuffered binary std{in,out,err} */
+int Py_NoRandomHashFlag = 0; /* Don't use randomized hashes */
PyThreadState *_Py_Finalizing = NULL;
+
/* PyModule_GetWarningsModule is no longer necessary as of 2.6
since _warnings is builtin. This API should not be used. */
PyObject *
@@ -218,6 +221,12 @@
Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
+ if ((p = Py_GETENV("PYTHONNORANDOMHASH")) && *p != '\0')
+ Py_NoRandomHashFlag = add_flag(Py_NoRandomHashFlag, p);
+
+ if (!Py_NoRandomHashFlag) {
+ _Py_InitRndHashSeed();
+ }
interp = PyInterpreterState_New();
if (interp == NULL)

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+