summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6fc3683..193d898 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -724,6 +724,11 @@ resize_compact(PyObject *unicode, Py_ssize_t length)
}
new_size = (struct_size + (length + 1) * char_size);
+ if (_PyUnicode_HAS_UTF8_MEMORY(unicode)) {
+ PyObject_DEL(_PyUnicode_UTF8(unicode));
+ _PyUnicode_UTF8(unicode) = NULL;
+ _PyUnicode_UTF8_LENGTH(unicode) = 0;
+ }
_Py_DEC_REFTOTAL;
_Py_ForgetReference(unicode);