(Merge 3.3) Issue #17137: When an Unicode string is resized, the internal wide

character string (wstr) format is now cleared.
This commit is contained in:
Victor Stinner 2013-02-07 23:17:34 +01:00
commit cfd2c1b4cc
3 changed files with 22 additions and 0 deletions

View file

@ -717,6 +717,10 @@ resize_compact(PyObject *unicode, Py_ssize_t length)
if (!PyUnicode_IS_ASCII(unicode))
_PyUnicode_WSTR_LENGTH(unicode) = length;
}
else if (_PyUnicode_HAS_WSTR_MEMORY(unicode)) {
PyObject_DEL(_PyUnicode_WSTR(unicode));
_PyUnicode_WSTR(unicode) = NULL;
}
#ifdef Py_DEBUG
unicode_fill_invalid(unicode, old_length);
#endif