summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-04-18 07:41:34 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-04-18 07:41:34 (GMT)
commitbb4503f61e5e2f2fb0a5c00950b9560bb46a5eb4 (patch)
treec4fab168a6c9ed591eaa1e88f5ef3beafc6a3423 /Objects
parentfb161b1b6d5234fca20b04b374645eaf896a4b38 (diff)
downloadcpython-bb4503f61e5e2f2fb0a5c00950b9560bb46a5eb4.zip
cpython-bb4503f61e5e2f2fb0a5c00950b9560bb46a5eb4.tar.gz
cpython-bb4503f61e5e2f2fb0a5c00950b9560bb46a5eb4.tar.bz2
Partial revert of changeset 9744b2df134c
PyUnicode_Append() cannot call directly resize_compact(): I forgot that a string can be ready *and* not compact (a legacy string can also be ready).
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 076674c..4c532af 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10748,12 +10748,11 @@ PyUnicode_Append(PyObject **p_left, PyObject *right)
&& !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right)))
{
/* append inplace */
- res = resize_compact(left, new_len);
- if (res == NULL)
+ if (unicode_resize(p_left, new_len) != 0)
goto error;
- /* copy 'right' into the newly allocated area of 'res' (left) */
- _PyUnicode_FastCopyCharacters(res, left_len, right, 0, right_len);
+ /* copy 'right' into the newly allocated area of 'left' */
+ _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
}
else {
maxchar = PyUnicode_MAX_CHAR_VALUE(left);
@@ -10767,8 +10766,8 @@ PyUnicode_Append(PyObject **p_left, PyObject *right)
_PyUnicode_FastCopyCharacters(res, 0, left, 0, left_len);
_PyUnicode_FastCopyCharacters(res, left_len, right, 0, right_len);
Py_DECREF(left);
+ *p_left = res;
}
- *p_left = res;
assert(_PyUnicode_CheckConsistency(*p_left, 1));
return;