diff -r 864b9836dae6 Objects/stringobject.c --- a/Objects/stringobject.c Fri Jan 25 17:55:39 2013 +0100 +++ b/Objects/stringobject.c Fri Jan 25 22:12:33 2013 +0200 @@ -10,8 +10,8 @@ Py_ssize_t null_strings, one_strings; #endif -static PyStringObject *characters[UCHAR_MAX + 1]; -static PyStringObject *nullstring; +static PyStringObject *characters[UCHAR_MAX + 1] = {NULL}; +static PyStringObject *nullstring = NULL; /* This dictionary holds all interned strings. Note that references to strings in this dictionary are *not* counted in the string's ob_refcnt. @@ -21,7 +21,7 @@ Another way to look at this is that to say that the actual reference count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) */ -static PyObject *interned; +static PyObject *interned = NULL; /* PyStringObject_SIZE gives the basic size of a string; any memory allocation for a string of length n should request PyStringObject_SIZE + n bytes. @@ -4786,12 +4786,9 @@ PyString_Fini(void) { int i; - for (i = 0; i < UCHAR_MAX + 1; i++) { - Py_XDECREF(characters[i]); - characters[i] = NULL; - } - Py_XDECREF(nullstring); - nullstring = NULL; + for (i = 0; i < UCHAR_MAX + 1; i++) + Py_CLEAR(characters[i]); + Py_CLEAR(nullstring); } void _Py_ReleaseInternedStrings(void) @@ -4841,6 +4838,5 @@ "mortal/immortal\n", mortal_size, immortal_size); Py_DECREF(keys); PyDict_Clear(interned); - Py_DECREF(interned); - interned = NULL; + Py_CLEAR(interned); }