[pypy-commit] pypy py3k: Create space.newunicode()

rlamy pypy.commits at gmail.com
Wed Jun 29 12:17:27 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3k
Changeset: r85452:d6b47988f9f3
Date: 2016-06-29 16:48 +0100
http://bitbucket.org/pypy/pypy/changeset/d6b47988f9f3/

Log:	Create space.newunicode()

diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -32,7 +32,7 @@
 from pypy.objspace.std.sliceobject import W_SliceObject
 from pypy.objspace.std.tupleobject import W_AbstractTupleObject, W_TupleObject
 from pypy.objspace.std.typeobject import W_TypeObject, TypeCache
-from pypy.objspace.std.unicodeobject import W_UnicodeObject, wrapunicode
+from pypy.objspace.std.unicodeobject import W_UnicodeObject
 
 
 class StdObjSpace(ObjSpace):
@@ -166,9 +166,9 @@
                     else:
                         lst.append(unichr(ch))
                 unicode_x = u''.join(lst)
-            return wrapunicode(self, unicode_x)
+            return self.newunicode(unicode_x)
         if isinstance(x, unicode):
-            return wrapunicode(self, x)
+            return self.newunicode(x)
         if isinstance(x, float):
             return W_FloatObject(x)
         if isinstance(x, W_Root):
@@ -342,6 +342,9 @@
         return W_BytesObject(s)
     wrapbytes = newbytes
 
+    def newunicode(self, uni):
+        return W_UnicodeObject(uni)
+
     def type(self, w_obj):
         jit.promote(w_obj.__class__)
         return w_obj.getclass(self)
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
@@ -19,7 +19,7 @@
 from pypy.objspace.std.stringmethods import StringMethods
 from pypy.objspace.std.util import IDTAG_SPECIAL, IDTAG_SHIFT
 
-__all__ = ['W_UnicodeObject', 'wrapunicode', 'encode_object', 'decode_object',
+__all__ = ['W_UnicodeObject', 'encode_object', 'decode_object',
            'unicode_from_object', 'unicode_to_decimal_w']
 
 
@@ -465,10 +465,6 @@
         return len(prefix) == 0
 
 
-def wrapunicode(space, uni):
-    return W_UnicodeObject(uni)
-
-
 def _isidentifier(u):
     if not u:
         return False


More information about the pypy-commit mailing list