From c9d369f1bf78c48083679b2afa5f31d8378ea94d Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 16 Jun 2012 02:22:37 +0200 Subject: Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to) --- Python/formatter_unicode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Python/formatter_unicode.c') 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; -- cgit v1.2.1