Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r94955:3814aec634e5
Date: 2018-08-05 14:53 -0700
http://bitbucket.org/pypy/pypy/changeset/3814aec634e5/

Log:    more internal unicode -> utf8

diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -515,7 +515,11 @@
                     elif fmt == 'T':
                         result = _decode_utf8(space.type(value).name)
                     elif fmt == 'N':
-                        result = _decode_utf8(value.getname(space))
+                        name = value.getname(space)
+                        if isinstance(name, unicode):
+                            result = name
+                        else:
+                            result = _decode_utf8(name)
                     elif fmt == '8':
                         # u'str\uxxxx' -> 'str\xXX\xXX' -> u"'str\xXX\xXX'"
                         if isinstance(value, unicode):
diff --git a/pypy/module/cpyext/classobject.py 
b/pypy/module/cpyext/classobject.py
--- a/pypy/module/cpyext/classobject.py
+++ b/pypy/module/cpyext/classobject.py
@@ -37,8 +37,8 @@
         return space.call_args(self.w_function, __args__)
 
     def descr_repr(self, space):
-        return self.getrepr(space, u'<instancemethod %s>' %
-                            (self.w_function.getname(space).decode('utf8'),))
+        return self.getrepr(space, '<instancemethod %s>' %
+                            (self.w_function.getname(space),))
 
 InstanceMethod.typedef = TypeDef("instancemethod",
     __new__ = interp2app(InstanceMethod.descr_new),
diff --git a/pypy/objspace/std/objectobject.py 
b/pypy/objspace/std/objectobject.py
--- a/pypy/objspace/std/objectobject.py
+++ b/pypy/objspace/std/objectobject.py
@@ -165,7 +165,7 @@
 
 def descr__repr__(space, w_obj):
     classname = space.getfulltypename(w_obj)
-    return w_obj.getrepr(space, u'%s object' % (classname,))
+    return w_obj.getrepr(space, '%s object' % (classname,))
 
 
 def descr__str__(space, w_obj):
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
@@ -757,7 +757,7 @@
     def getfulltypename(self, w_obj):
         w_type = self.type(w_obj)
         if w_type.is_heaptype():
-            classname = w_type.getqualname(self).decode('utf8')
+            classname = w_type.getqualname(self)
             w_module = w_type.lookup("__module__")
             if w_module is not None:
                 try:
@@ -766,7 +766,7 @@
                     if not e.match(self, self.w_TypeError):
                         raise
                 else:
-                    classname = u'%s.%s' % (modulename.decode('utf8'), 
classname)
+                    classname = '%s.%s' % (modulename, classname)
         else:
-            classname = w_type.name.decode('utf-8')
+            classname = w_type.name
         return classname
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to