Kaydet (Commit) bb4503f6 authored tarafından Victor Stinner's avatar Victor Stinner

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).
üst fb161b1b
...@@ -10748,12 +10748,11 @@ PyUnicode_Append(PyObject **p_left, PyObject *right) ...@@ -10748,12 +10748,11 @@ PyUnicode_Append(PyObject **p_left, PyObject *right)
&& !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right))) && !(PyUnicode_IS_ASCII(left) && !PyUnicode_IS_ASCII(right)))
{ {
/* append inplace */ /* append inplace */
res = resize_compact(left, new_len); if (unicode_resize(p_left, new_len) != 0)
if (res == NULL)
goto error; goto error;
/* copy 'right' into the newly allocated area of 'res' (left) */ /* copy 'right' into the newly allocated area of 'left' */
_PyUnicode_FastCopyCharacters(res, left_len, right, 0, right_len); _PyUnicode_FastCopyCharacters(*p_left, left_len, right, 0, right_len);
} }
else { else {
maxchar = PyUnicode_MAX_CHAR_VALUE(left); maxchar = PyUnicode_MAX_CHAR_VALUE(left);
...@@ -10767,8 +10766,8 @@ PyUnicode_Append(PyObject **p_left, PyObject *right) ...@@ -10767,8 +10766,8 @@ PyUnicode_Append(PyObject **p_left, PyObject *right)
_PyUnicode_FastCopyCharacters(res, 0, left, 0, left_len); _PyUnicode_FastCopyCharacters(res, 0, left, 0, left_len);
_PyUnicode_FastCopyCharacters(res, left_len, right, 0, right_len); _PyUnicode_FastCopyCharacters(res, left_len, right, 0, right_len);
Py_DECREF(left); Py_DECREF(left);
*p_left = res;
} }
*p_left = res;
assert(_PyUnicode_CheckConsistency(*p_left, 1)); assert(_PyUnicode_CheckConsistency(*p_left, 1));
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment