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

arigo at codespeak.net arigo at codespeak.net
Sat Sep 17 18:17:19 CEST 2005


Author: arigo
Date: Sat Sep 17 18:17:17 2005
New Revision: 17618

Modified:
   pypy/dist/pypy/objspace/std/unicodeobject.py
   pypy/dist/pypy/objspace/std/unicodetype.py
Log:
Removed unicode.__getslice__() -- we don't have this method anywhere else.
I'm prepared to blame and fix any 2.4.1 compliance test that fails because
of it.


Modified: pypy/dist/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodeobject.py	Sat Sep 17 18:17:17 2005
@@ -231,19 +231,14 @@
     uni = w_uni._value
     length = len(uni)
     start, stop, step, sl = slicetype.indices4(space, w_slice, length)
-    r = [uni[start + i*step] for i in range(sl)]
-    return W_UnicodeObject(space, r)
-
-def unicode_getslice__Unicode_ANY_ANY(space, w_uni, w_start, w_end):
-    w_slice = space.call_function(space.w_slice, w_start, w_end)
-    uni = w_uni._value
-    length = len(uni)
-    start, stop, step, sl = slicetype.indices4(space, w_slice, length)
-    if start > stop:
-        return W_UnicodeObject(space, [])
+    if sl == 0:
+        r = []
+    elif step == 1:
+        assert start >= 0 and stop >= 0
+        r = uni[start:stop]
     else:
-        assert 0 <= start <= stop
-        return W_UnicodeObject(space, uni[start:stop])
+        r = [uni[start + i*step] for i in range(sl)]
+    return W_UnicodeObject(space, r)
 
 def mul__Unicode_ANY(space, w_uni, w_times):
     chars = w_uni._value

Modified: pypy/dist/pypy/objspace/std/unicodetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodetype.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodetype.py	Sat Sep 17 18:17:17 2005
@@ -40,7 +40,7 @@
 unicode_translate  = MultiMethod('translate', 2)
 unicode_upper      = MultiMethod('upper', 1)
 unicode_zfill      = MultiMethod('zfill', 2)
-unicode_getslice   = MultiMethod('__getslice__', 3)
+
 # ____________________________________________________________
 
 app = gateway.applevel('''



More information about the Pypy-commit mailing list