diff Python/formatter_unicode.c @ 77460:00b4451bf94c

Optimize _PyUnicode_FastCopyCharacters() when maxchar(from) > maxchar(to)
author Victor Stinner <victor.stinner@gmail.com>
date Sat, 16 Jun 2012 02:22:37 +0200
parents 22b56b0b8619
children d8244d4dbe37
line wrap: on
line diff
--- a/Python/formatter_unicode.c	Sat Jun 16 01:53:04 2012 +0200
+++ b/Python/formatter_unicode.c	Sat Jun 16 02:22:37 2012 +0200
@@ -786,8 +786,10 @@
         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;