]> granicus.if.org Git - python/commitdiff
kill interned strings computed before random initialization
authorBenjamin Peterson <benjamin@python.org>
Tue, 21 Feb 2012 05:40:14 +0000 (00:40 -0500)
committerBenjamin Peterson <benjamin@python.org>
Tue, 21 Feb 2012 05:40:14 +0000 (00:40 -0500)
Modules/main.c

index 6d1ae9ed68761d807ca6fd7424ddfc71342d3ef1..824badafbe04f4c7d281ccc1e7129eb4046743d2 100644 (file)
@@ -397,6 +397,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':