[pypy-svn] r8798 - pypy/dist/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Wed Feb 2 12:24:58 CET 2005


Author: arigo
Date: Wed Feb  2 12:24:58 2005
New Revision: 8798

Modified:
   pypy/dist/pypy/objspace/std/stringobject.py
Log:
Fixed the signature of string multimethods to replace Int with ANY for integer
arguments that are unwrapped with int_w() anyway.


Modified: pypy/dist/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringobject.py	(original)
+++ pypy/dist/pypy/objspace/std/stringobject.py	Wed Feb  2 12:24:58 2005
@@ -256,7 +256,7 @@
 
     return space.wrap("".join(buffer))
 
-def str_split__String_None_Int(space, w_self, w_none, w_maxsplit=-1):
+def str_split__String_None_ANY(space, w_self, w_none, w_maxsplit=-1):
     res = []
     inword = 0
     value = w_self._value
@@ -284,7 +284,7 @@
         res[i] = W_StringObject(space, res[i])
     return W_ListObject(space, res)
 
-def str_split__String_String_Int(space, w_self, w_by, w_maxsplit=-1):
+def str_split__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
     res = []
     start = 0
     value = w_self._value
@@ -440,7 +440,7 @@
     return space.wrap(res)
 
 
-def str_replace__String_String_String_Int(space, w_self, w_sub, w_by, w_maxsplit=-1):
+def str_replace__String_String_String_ANY(space, w_self, w_sub, w_by, w_maxsplit=-1):
 
     input = w_self._value
     sub = w_sub._value
@@ -591,7 +591,7 @@
     return _strip_none(space, w_self, left=1, right=0)
 
 
-def str_center__String_Int(space, w_self, w_arg):
+def str_center__String_ANY(space, w_self, w_arg):
     u_self = w_self._value
     u_arg  = space.int_w(w_arg)
 
@@ -684,7 +684,7 @@
     return distance    
     
     
-def str_expandtabs__String_Int(space, w_self, w_tabsize):   
+def str_expandtabs__String_ANY(space, w_self, w_tabsize):   
     u_self = w_self._value
     u_tabsize  = space.int_w(w_tabsize)
     
@@ -701,9 +701,9 @@
     return W_StringObject(space, u_expanded)        
  
  
-def str_splitlines__String_Int(space, w_self, w_keepends):
+def str_splitlines__String_ANY(space, w_self, w_keepends):
     u_self = w_self._value
-    u_keepends  = space.is_true(w_keepends)
+    u_keepends  = space.int_w(w_keepends)  # truth value, but type checked
     selflen = len(u_self)
     
     L = []
@@ -720,7 +720,7 @@
             break    
     return W_ListObject(space, L)
 
-def str_zfill__String_Int(space, w_self, w_width):
+def str_zfill__String_ANY(space, w_self, w_width):
     input = w_self._value
     width = space.int_w(w_width)
 



More information about the Pypy-commit mailing list