Improve string forms and PyUnicode_Resize() documentation

Remove also the FIXME for resize_copy(): as discussed with Martin, copy the
string on resize if the string is not resizable is just fine.
This commit is contained in:
Victor Stinner 2011-10-03 23:19:21 +02:00
parent 77bb47b312
commit 8cfcbed4e3
2 changed files with 24 additions and 15 deletions

View file

@ -536,7 +536,8 @@ resize_copy(PyObject *unicode, Py_ssize_t length)
return NULL;
}
return copy;
} else {
}
else {
PyUnicodeObject *w;
assert(_PyUnicode_WSTR(unicode) != NULL);
assert(_PyUnicode_DATA_ANY(unicode) == NULL);
@ -1294,7 +1295,6 @@ unicode_resize(PyObject **p_unicode, Py_ssize_t length)
if (old_length == length)
return 0;
/* FIXME: really create a new object? */
if (!unicode_resizable(unicode)) {
PyObject *copy = resize_copy(unicode, length);
if (copy == NULL)