mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
77bb47b312
commit
8cfcbed4e3
2 changed files with 24 additions and 15 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue