[Python-checkins] cpython (2.6): Backport fix from default branch for ./python -R -Wd where hash('d') would not

barry.warsaw python-checkins at python.org
Tue Feb 21 17:19:43 CET 2012


http://hg.python.org/cpython/rev/4c69ec7e9bca
changeset:   75130:4c69ec7e9bca
branch:      2.6
parent:      75124:04738f35e0ec
user:        Barry Warsaw <barry at python.org>
date:        Tue Feb 21 11:16:06 2012 -0500
summary:
  Backport fix from default branch for ./python -R -Wd where hash('d') would not
have gotten randomized.

files:
  Modules/main.c |  6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)


diff --git a/Modules/main.c b/Modules/main.c
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -396,6 +396,12 @@
 
         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':

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list