[pypy-commit] pypy virtual-arguments: some more

fijal noreply at buildbot.pypy.org
Wed Jul 18 15:34:10 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: virtual-arguments
Changeset: r56151:b33078c40d3d
Date: 2012-07-18 15:33 +0200
http://bitbucket.org/pypy/pypy/changeset/b33078c40d3d/

Log:	some more

diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -557,6 +557,7 @@
     if padding < 0:
         return w_self.create_if_subclassed()
     leftpad = padding // 2 + (padding & width & 1)
+    assert width >= 0
     result = [fillchar] * width
     for i in range(len(self)):
         result[leftpad + i] = self[i]
@@ -569,6 +570,7 @@
     padding = width - len(self)
     if padding < 0:
         return w_self.create_if_subclassed()
+    assert width >= 0
     result = [fillchar] * width
     for i in range(len(self)):
         result[i] = self[i]
@@ -581,6 +583,7 @@
     padding = width - len(self)
     if padding < 0:
         return w_self.create_if_subclassed()
+    assert width >= 0
     result = [fillchar] * width
     for i in range(len(self)):
         result[padding + i] = self[i]
@@ -590,6 +593,8 @@
     self = w_self._value
     width = space.int_w(w_width)
     if len(self) == 0:
+        if width < 0:
+            width = 0
         return W_UnicodeObject(u'0' * width)
     padding = width - len(self)
     if padding <= 0:


More information about the pypy-commit mailing list