summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2012-02-21 11:16:06 -0500
committerBarry Warsaw <barry@python.org>2012-02-21 11:16:06 -0500
commitb3f4ebb61d9bddf85a7e7a8772e9a15dfa6cc605 (patch)
tree0c1eb75803229c829c0942699ffebf2c1ccced09
parent8f36ecca92f19c931fae566b134fc0bacbca0f8a (diff)
downloadcpython-b3f4ebb61d9bddf85a7e7a8772e9a15dfa6cc605.tar.gz
Backport fix from default branch for ./python -R -Wd where hash('d') would not
have gotten randomized.
-rw-r--r--Modules/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/main.c b/Modules/main.c
index a57d00b359..780d877b51 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -396,6 +396,12 @@ Py_Main(int argc, char **argv)
case 'W':
PySys_AddWarnOption(_PyOS_optarg);
+ /* Extremely obscure hack: if _PyOS_optarg was one character,
+ PyString_FromString in PySys_AddWarnOption will try to intern
+ it. This is bad because hash randomization has not been setup
+ yet, so the string will get the wrong hash. The following call
+ will cause all the cached characters to be released. */
+ PyString_Fini();
break;
case 'R':