[Python-checkins] cpython (merge 3.3 -> default): merge 3.3 (#16906)

benjamin.peterson python-checkins at python.org
Wed Jan 9 16:52:38 CET 2013


http://hg.python.org/cpython/rev/0c04ed40eeaf
changeset:   81340:0c04ed40eeaf
parent:      81338:0793d68a0eba
parent:      81339:3e18ccaa537e
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Jan 09 09:52:22 2013 -0600
summary:
  merge 3.3 (#16906)

files:
  Misc/NEWS               |   3 +++
  Objects/unicodeobject.c |  15 +++++++++------
  2 files changed, 12 insertions(+), 6 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #16906: Fix a logic error that prevented most static strings from being
+  cleared.
+
 - Issue #11461: Fix the incremental UTF-16 decoder. Original patch by
   Amaury Forgeot d'Arc.
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1822,12 +1822,15 @@
 void
 _PyUnicode_ClearStaticStrings()
 {
-    _Py_Identifier *i;
-    for (i = static_strings; i; i = i->next) {
-        Py_DECREF(i->object);
-        i->object = NULL;
-        i->next = NULL;
-    }
+    _Py_Identifier *tmp, *s = static_strings;
+    while (s) {
+        Py_DECREF(s->object);
+        s->object = NULL;
+        tmp = s->next;
+        s->next = NULL;
+        s = tmp;
+    }
+    static_strings = NULL;
 }
 
 /* Internal function, doesn't check maximum character */

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


More information about the Python-checkins mailing list