diff --git a/Misc/NEWS b/Misc/NEWS index 73809ec6adc..f6e4b4c158d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1? 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 index 41c35499a9e..6a12d71f876 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1822,12 +1822,15 @@ _PyUnicode_FromId(_Py_Identifier *id) 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 */