diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-02-07 22:12:46 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-02-07 22:12:46 (GMT) |
commit | bbbac2ec34e99c24d7bc0eedbcc138c5f4551d48 (patch) | |
tree | d78b2fead0311d37b6f76d0a3466fd78196c8c31 /Objects | |
parent | 2efdc90b0f49866d857a5b3dc21b7c791f7a0aeb (diff) | |
download | cpython-bbbac2ec34e99c24d7bc0eedbcc138c5f4551d48.zip cpython-bbbac2ec34e99c24d7bc0eedbcc138c5f4551d48.tar.gz cpython-bbbac2ec34e99c24d7bc0eedbcc138c5f4551d48.tar.bz2 |
Issue #17137: When an Unicode string is resized, the internal wide character
string (wstr) format is now cleared.
Diffstat (limited to 'Objects')
-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 abe793d..51160f8 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -702,6 +702,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; + } PyUnicode_WRITE(PyUnicode_KIND(unicode), PyUnicode_DATA(unicode), length, 0); assert(_PyUnicode_CheckConsistency(unicode, 0)); |