diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-06-16 00:22:37 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-06-16 00:22:37 (GMT) |
commit | c9d369f1bf78c48083679b2afa5f31d8378ea94d (patch) | |
tree | 610388d08918fbb6fdafa6e5f7fa7123d0ec8a19 /Python | |
parent | f05e17ece9ee4cf4d04e0657e6c7c9283a233968 (diff) | |
download | cpython-c9d369f1bf78c48083679b2afa5f31d8378ea94d.zip cpython-c9d369f1bf78c48083679b2afa5f31d8378ea94d.tar.gz cpython-c9d369f1bf78c48083679b2afa5f31d8378ea94d.tar.bz2 |
Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
Diffstat (limited to 'Python')
-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 fdb587d..cd66670 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; |