Added internal routine PyString_Fini() which deletes all interned
strings. For use in Py_Finalize() only.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 5e3f9fa..40dfc9e 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -1073,3 +1073,21 @@
}
#endif
+
+void
+PyString_Fini()
+{
+ int i;
+#ifdef INTERN_STRINGS
+ Py_XDECREF(interned);
+ interned = NULL;
+#endif
+ for (i = 0; i < UCHAR_MAX + 1; i++) {
+ Py_XDECREF(characters[i]);
+ characters[i] = NULL;
+ }
+#ifndef DONT_SHARE_SHORT_STRINGS
+ Py_XDECREF(nullstring);
+ nullstring = NULL;
+#endif
+}