Skip to content

Commit 8cf0476

Browse files
committed
Added internal routine PyString_Fini() which deletes all interned
strings. For use in Py_Finalize() only.
1 parent 29e46a9 commit 8cf0476

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Objects/stringobject.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,3 +1073,21 @@ PyString_InternFromString(cp)
10731073
}
10741074

10751075
#endif
1076+
1077+
void
1078+
PyString_Fini()
1079+
{
1080+
int i;
1081+
#ifdef INTERN_STRINGS
1082+
Py_XDECREF(interned);
1083+
interned = NULL;
1084+
#endif
1085+
for (i = 0; i < UCHAR_MAX + 1; i++) {
1086+
Py_XDECREF(characters[i]);
1087+
characters[i] = NULL;
1088+
}
1089+
#ifndef DONT_SHARE_SHORT_STRINGS
1090+
Py_XDECREF(nullstring);
1091+
nullstring = NULL;
1092+
#endif
1093+
}

0 commit comments

Comments
 (0)