[pypy-commit] pypy py3k: Remove str -> unicode delegation

amauryfa noreply at buildbot.pypy.org
Wed Oct 12 22:23:37 CEST 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r47996:83e0cb6106b6
Date: 2011-10-12 22:19 +0200
http://bitbucket.org/pypy/pypy/changeset/83e0cb6106b6/

Log:	Remove str -> unicode delegation

diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py
--- a/pypy/objspace/std/model.py
+++ b/pypy/objspace/std/model.py
@@ -212,40 +212,20 @@
         self.typeorder[setobject.W_FrozensetObject] += [
             (setobject.W_BaseSetObject, None)
             ]
-        if not config.objspace.std.withrope:
-            self.typeorder[stringobject.W_StringObject] += [
-             (unicodeobject.W_UnicodeObject, unicodeobject.delegate_String2Unicode),
-                ]
-        else:
-            if config.objspace.std.withropeunicode:
-                self.typeorder[ropeobject.W_RopeObject] += [
-                 (ropeunicodeobject.W_RopeUnicodeObject,
-                     ropeunicodeobject.delegate_Rope2RopeUnicode),
-                 ]
-            else:
-                self.typeorder[ropeobject.W_RopeObject] += [
-                 (unicodeobject.W_UnicodeObject, unicodeobject.delegate_String2Unicode),
-                    ]
         if config.objspace.std.withstrslice:
             self.typeorder[strsliceobject.W_StringSliceObject] += [
                 (stringobject.W_StringObject,
                                        strsliceobject.delegate_slice2str),
-                (unicodeobject.W_UnicodeObject,
-                                       strsliceobject.delegate_slice2unicode),
                 ]
         if config.objspace.std.withstrjoin:
             self.typeorder[strjoinobject.W_StringJoinObject] += [
                 (stringobject.W_StringObject,
                                        strjoinobject.delegate_join2str),
-                (unicodeobject.W_UnicodeObject,
-                                       strjoinobject.delegate_join2unicode)
                 ]
         elif config.objspace.std.withstrbuf:
             self.typeorder[strbufobject.W_StringBufferObject] += [
                 (stringobject.W_StringObject,
                                        strbufobject.delegate_buf2str),
-                (unicodeobject.W_UnicodeObject,
-                                       strbufobject.delegate_buf2unicode)
                 ]
         if config.objspace.std.withsmalltuple:
             self.typeorder[smalltupleobject.W_SmallTupleObject] += [
diff --git a/pypy/objspace/std/strbufobject.py b/pypy/objspace/std/strbufobject.py
--- a/pypy/objspace/std/strbufobject.py
+++ b/pypy/objspace/std/strbufobject.py
@@ -1,7 +1,6 @@
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.stringobject import W_StringObject
-from pypy.objspace.std.unicodeobject import delegate_String2Unicode
 from pypy.rlib.rstring import StringBuilder
 from pypy.interpreter.buffer import Buffer
 
@@ -51,10 +50,6 @@
     w_strbuf.force()
     return w_strbuf.w_str
 
-def delegate_buf2unicode(space, w_strbuf):
-    w_strbuf.force()
-    return delegate_String2Unicode(space, w_strbuf.w_str)
-
 def len__StringBuffer(space, w_self):
     return space.wrap(w_self.length)
 
diff --git a/pypy/objspace/std/strjoinobject.py b/pypy/objspace/std/strjoinobject.py
--- a/pypy/objspace/std/strjoinobject.py
+++ b/pypy/objspace/std/strjoinobject.py
@@ -1,7 +1,6 @@
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.stringobject import W_StringObject
-from pypy.objspace.std.unicodeobject import delegate_String2Unicode
 
 from pypy.objspace.std.stringtype import wrapstr
 
@@ -36,10 +35,6 @@
 def delegate_join2str(space, w_strjoin):
     return wrapstr(space, w_strjoin.force())
 
-def delegate_join2unicode(space, w_strjoin):
-    w_str = wrapstr(space, w_strjoin.force())
-    return delegate_String2Unicode(space, w_str)
-
 def len__StringJoin(space, w_self):
     result = 0
     for i in range(w_self.until):
diff --git a/pypy/objspace/std/strsliceobject.py b/pypy/objspace/std/strsliceobject.py
--- a/pypy/objspace/std/strsliceobject.py
+++ b/pypy/objspace/std/strsliceobject.py
@@ -2,7 +2,6 @@
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
 from pypy.objspace.std.stringobject import W_StringObject
-from pypy.objspace.std.unicodeobject import delegate_String2Unicode
 from pypy.objspace.std.sliceobject import W_SliceObject, normalize_simple_slice
 from pypy.objspace.std.tupleobject import W_TupleObject
 from pypy.objspace.std import slicetype
@@ -46,10 +45,6 @@
 def delegate_slice2str(space, w_strslice):
     return wrapstr(space, w_strslice.force())
 
-def delegate_slice2unicode(space, w_strslice):
-    w_str = wrapstr(space, w_strslice.force())
-    return delegate_String2Unicode(space, w_str)
-
 # ____________________________________________________________
 
 def contains__StringSlice_String(space, w_self, w_sub):
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
@@ -78,13 +78,6 @@
                 raise OperationError(space.w_UnicodeEncodeError, space.newtuple([w_encoding, w_unistr, w_start, w_end, w_reason]))
     return ''.join(result)
 
-# string-to-unicode delegation
-def delegate_String2Unicode(space, w_str):
-    from pypy.objspace.std.unicodetype import unicode_from_string
-    w_uni = unicode_from_string(space, w_str)
-    assert isinstance(w_uni, W_UnicodeObject) # help the annotator!
-    return w_uni
-
 # checks if should trigger an unicode warning
 def _unicode_string_comparison(space, w_uni, w_str, inverse, uni_from_str):
     try:


More information about the pypy-commit mailing list