[pypy-svn] r14227 - pypy/branch/dist-2.4.1/pypy/objspace/std

ac at codespeak.net ac at codespeak.net
Mon Jul 4 17:28:43 CEST 2005


Author: ac
Date: Mon Jul  4 17:28:42 2005
New Revision: 14227

Modified:
   pypy/branch/dist-2.4.1/pypy/objspace/std/stringobject.py
   pypy/branch/dist-2.4.1/pypy/objspace/std/unicodeobject.py
Log:
str.center() should not return a unicode string unless the fillchar is
unicode.



Modified: pypy/branch/dist-2.4.1/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/branch/dist-2.4.1/pypy/objspace/std/stringobject.py	(original)
+++ pypy/branch/dist-2.4.1/pypy/objspace/std/stringobject.py	Mon Jul  4 17:28:42 2005
@@ -639,6 +639,7 @@
     return _strip_none(space, w_self, left=1, right=0)
 
 
+
 def str_center__String_ANY_ANY(space, w_self, w_arg, w_fillchar):
     u_self = w_self._value
     u_arg  = space.int_w(w_arg)
@@ -656,6 +657,11 @@
         u_centered = u_self
 
     return W_StringObject(space, u_centered)
+
+# This is so that str_center__String_ANY_Unicode in unicodeobject
+# won't convert a String fillchar
+def str_center__String_ANY_String(space, w_self, w_arg, w_fillchar):
+    return str_center__String_ANY_ANY(space, w_self, w_arg, w_fillchar)
       
       
 def str_count__String_String_ANY_ANY(space, w_self, w_arg, w_start, w_end): 

Modified: pypy/branch/dist-2.4.1/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/branch/dist-2.4.1/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/branch/dist-2.4.1/pypy/objspace/std/unicodeobject.py	Mon Jul  4 17:28:42 2005
@@ -916,6 +916,7 @@
                                  'rsplit', w_delim, w_maxsplit)
 
     def str_center__String_ANY_Unicode(space, w_self, w_width, w_fillchar):
+        print 'Centering a string with unicode.'
         return space.call_method(space.call_function(space.w_unicode, w_self),
                                  'center', w_width, w_fillchar)
 



More information about the Pypy-commit mailing list