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
commitc9d369f1bf78c48083679b2afa5f31d8378ea94d (patch)
tree610388d08918fbb6fdafa6e5f7fa7123d0ec8a19 /Python/formatter_unicode.c
parentf05e17ece9ee4cf4d04e0657e6c7c9283a233968 (diff)
downloadcpython-git-c9d369f1bf78c48083679b2afa5f31d8378ea94d.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;