summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-10-03 10:11:00 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-10-03 10:11:00 (GMT)
commit1c8d0c76a17283f165c6140e5e537d0bdc482057 (patch)
tree16b2421269c4caa8f557313f8d674039304e6c24
parentca4f7a42986979ff938586aa6cca6c0aa208560e (diff)
downloadcpython-1c8d0c76a17283f165c6140e5e537d0bdc482057.zip
cpython-1c8d0c76a17283f165c6140e5e537d0bdc482057.tar.gz
cpython-1c8d0c76a17283f165c6140e5e537d0bdc482057.tar.bz2
Fix resize_inplace(): update shared utf8 pointer
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 68278e6..e8b19cf 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -443,13 +443,14 @@ resize_inplace(register PyUnicodeObject *unicode, Py_ssize_t length)
if (PyUnicode_IS_READY(unicode)) {
Py_ssize_t char_size;
Py_ssize_t new_size;
- int share_wstr;
+ int share_wstr, share_utf8;
void *data;
data = _PyUnicode_DATA_ANY(unicode);
assert(data != NULL);
char_size = PyUnicode_CHARACTER_SIZE(unicode);
share_wstr = (_PyUnicode_WSTR(unicode) == data);
+ share_utf8 = (_PyUnicode_UTF8(unicode) == data);
if (length > (PY_SSIZE_T_MAX / char_size - 1)) {
PyErr_NoMemory();
@@ -465,6 +466,8 @@ resize_inplace(register PyUnicodeObject *unicode, Py_ssize_t length)
_PyUnicode_DATA_ANY(unicode) = data;
if (share_wstr)
_PyUnicode_WSTR(unicode) = data;
+ if (share_utf8)
+ _PyUnicode_UTF8(unicode) = data;
_PyUnicode_LENGTH(unicode) = length;
PyUnicode_WRITE(PyUnicode_KIND(unicode), data, length, 0);
if (share_wstr)