Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)

This commit is contained in:
Victor Stinner 2012-06-16 02:22:37 +02:00
parent f05e17ece9
commit c9d369f1bf
2 changed files with 79 additions and 57 deletions

View file

@ -786,8 +786,10 @@ format_string_internal(PyObject *value, const InternalFormatSpec *format,
goto done;
/* Then the source string. */
_PyUnicode_FastCopyCharacters(writer->buffer, writer->pos,
value, 0, len);
if (len) {
_PyUnicode_FastCopyCharacters(writer->buffer, writer->pos,
value, 0, len);
}
writer->pos += (len + rpad);
result = 0;