summaryrefslogtreecommitdiff
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-06-16 02:22:37 +0200
committerVictor Stinner <victor.stinner@gmail.com>2012-06-16 02:22:37 +0200
commit8ebaf6f9098e414c044616640ce8200a6c094af5 (patch)
tree7e3bacc6a4312fbecc6e4bbd058f02771f2e8b02 /Python/formatter_unicode.c
parent10df1c2b685f09564f8d3d71acbfbedf14f7cc6a (diff)
downloadcpython-8ebaf6f9098e414c044616640ce8200a6c094af5.tar.gz
Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c6
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;