Commits

Amaury Forgeot d'Arc  committed 83e0cb6

Remove str -> unicode delegation

  • Participants
  • Parent commits 4da383a
  • Branches py3k

Comments (0)

Files changed (5)

File pypy/objspace/std/model.py

         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] += [

File pypy/objspace/std/strbufobject.py

 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
 
     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)
 

File pypy/objspace/std/strjoinobject.py

 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
 
 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):

File pypy/objspace/std/strsliceobject.py

 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
 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):

File pypy/objspace/std/unicodeobject.py

                 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: