diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2012-06-16 02:22:37 +0200 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2012-06-16 02:22:37 +0200 |
| commit | 8ebaf6f9098e414c044616640ce8200a6c094af5 (patch) | |
| tree | 7e3bacc6a4312fbecc6e4bbd058f02771f2e8b02 /Python/formatter_unicode.c | |
| parent | 10df1c2b685f09564f8d3d71acbfbedf14f7cc6a (diff) | |
| download | cpython-8ebaf6f9098e414c044616640ce8200a6c094af5.tar.gz | |
Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
Diffstat (limited to 'Python/formatter_unicode.c')
| -rw-r--r-- | Python/formatter_unicode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c index fdb587d073..cd6667053e 100644 --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -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; |
