summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-02-21 21:08:05 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-02-21 21:08:05 (GMT)
commitc9f54cf512996790266c17f81584c9725ee99d47 (patch)
treef1208c4e6d7a2f2065a9ebcac6d602eedf8aae66 /Modules
parent6ca5a4d49fdc55c2555a9692097e9966fd8b804f (diff)
downloadcpython-c9f54cf512996790266c17f81584c9725ee99d47.zip
cpython-c9f54cf512996790266c17f81584c9725ee99d47.tar.gz
cpython-c9f54cf512996790266c17f81584c9725ee99d47.tar.bz2
enable hash randomization by default
Diffstat (limited to 'Modules')
-rw-r--r--Modules/main.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/Modules/main.c b/Modules/main.c
index d026033..8241ee4 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -73,9 +73,6 @@ static char *usage_2 = "\
-O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
-OO : remove doc-strings in addition to the -O optimizations\n\
-q : don't print version and copyright messages on interactive startup\n\
--R : use a pseudo-random salt to make hash() values of various types be\n\
- unpredictable between separate invocations of the interpreter, as\n\
- a defence against denial-of-service attacks\n\
-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
-S : don't imply 'import site' on initialization\n\
";
@@ -107,10 +104,10 @@ static char *usage_5 =
"PYTHONFAULTHANDLER: dump the Python traceback on fatal errors.\n\
";
static char *usage_6 = "\
-PYTHONHASHSEED: if this variable is set to ``random``, the effect is the same \n\
- as specifying the :option:`-R` option: a random value is used to seed the\n\
- hashes of str, bytes and datetime objects. It can also be set to an integer\n\
- in the range [0,4294967295] to get hash values with a predictable seed.\n\
+PYTHONHASHSEED: if this variable is set to ``random``, a random value is used\n\
+ to seed the hashes of str, bytes and datetime objects. It can also be\n\
+ set to an integer in the range [0,4294967295] to get hash values with a\n\
+ predictable seed.\n\
";
static int
@@ -347,21 +344,13 @@ Py_Main(int argc, wchar_t **argv)
not interpreter options. */
break;
}
- switch (c) {
- case 'E':
+ if (c == 'E') {
Py_IgnoreEnvironmentFlag++;
break;
- case 'R':
- Py_HashRandomizationFlag++;
- break;
}
}
- /* The variable is only tested for existence here; _PyRandom_Init will
- check its value further. */
- if (!Py_HashRandomizationFlag &&
- (p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
- Py_HashRandomizationFlag = 1;
+ Py_HashRandomizationFlag = 1;
_PyRandom_Init();
PySys_ResetWarnOptions();
@@ -468,7 +457,7 @@ Py_Main(int argc, wchar_t **argv)
break;
case 'R':
- /* Already handled above */
+ /* Ignored */
break;
/* This space reserved for other options */