diff options
-rw-r--r-- | Include/stringobject.h | 2 | ||||
-rw-r--r-- | Objects/stringobject.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Include/stringobject.h b/Include/stringobject.h index 85ac0b6..cadd78e 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -65,9 +65,11 @@ extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int, #ifdef INTERN_STRINGS extern DL_IMPORT(void) PyString_InternInPlace(PyObject **); extern DL_IMPORT(PyObject *) PyString_InternFromString(const char *); +extern DL_IMPORT(void) _Py_ReleaseInternedStrings(void); #else #define PyString_InternInPlace(p) #define PyString_InternFromString(cp) PyString_FromString(cp) +#define _Py_ReleaseInternedStrings() #endif /* Macro, trading safety for speed */ diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 9cf64ba..740cbe2 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -3217,3 +3217,13 @@ PyString_Fini(void) } #endif } + +#ifdef INTERN_STRINGS +void _Py_ReleaseInternedStrings(void) +{ + if (interned) { + Py_DECREF(interned); + interned = NULL; + } +} +#endif /* INTERN_STRINGS */ |