diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-02-07 22:17:34 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-02-07 22:17:34 (GMT) |
commit | cfd2c1b4ccb4355a914c7e4084141d522ada8666 (patch) | |
tree | 76c283a1452f58ef816f3695778119f82b512443 /Objects/unicodeobject.c | |
parent | eae3b3331607fcf0ac888aa2f1e34c19fe2f0a7f (diff) | |
parent | bbbac2ec34e99c24d7bc0eedbcc138c5f4551d48 (diff) | |
download | cpython-cfd2c1b4ccb4355a914c7e4084141d522ada8666.zip cpython-cfd2c1b4ccb4355a914c7e4084141d522ada8666.tar.gz cpython-cfd2c1b4ccb4355a914c7e4084141d522ada8666.tar.bz2 |
(Merge 3.3) Issue #17137: When an Unicode string is resized, the internal wide
character string (wstr) format is now cleared.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 8596e54..4d38049 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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 |