[pypy-commit] pypy set-strategies: merge with default

l.diekmann noreply at buildbot.pypy.org
Thu Nov 10 13:52:11 CET 2011


Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: set-strategies
Changeset: r49245:a07d1bf6b358
Date: 2011-10-14 15:34 +0200
http://bitbucket.org/pypy/pypy/changeset/a07d1bf6b358/

Log:	merge with default

diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -756,7 +756,8 @@
     input = w_self._value
     width = space.int_w(w_width)
 
-    if len(input) >= width:
+    num_zeros = width - len(input)
+    if num_zeros <= 0:
         # cannot return w_self, in case it is a subclass of str
         return space.wrap(input)
 
@@ -764,13 +765,11 @@
     if len(input) > 0 and (input[0] == '+' or input[0] == '-'):
         builder.append(input[0])
         start = 1
-        middle = width - len(input) + 1
     else:
         start = 0
-        middle = width - len(input)
 
-    builder.append_multiple_char('0', middle - start)
-    builder.append(input[start:start + (width - middle)])
+    builder.append_multiple_char('0', num_zeros)
+    builder.append_slice(input, start, len(input))
     return space.wrap(builder.build())
 
 
diff --git a/pypy/tool/logparser.py b/pypy/tool/logparser.py
--- a/pypy/tool/logparser.py
+++ b/pypy/tool/logparser.py
@@ -298,6 +298,8 @@
         image.paste(textpercent, (t1x, 5), textpercent)
         image.paste(textlabel,   (t2x, 5), textlabel)
         images.append(image)
+    if not images:
+        return None
     return combine(images, spacing=0, border=1, horizontal=False)
 
 def get_timesummary_single_image(totaltimes, totaltime0, componentdict,
@@ -333,6 +335,8 @@
         del totaltimes[None]
     img2 = render_histogram(totaltimes, totaltime0, {},
                             width, summarybarheight)
+    if img2 is None:
+        return img1
     return combine([img1, img2], spacing=spacing, horizontal=True)
 
 # ----------


More information about the pypy-commit mailing list