Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r94964:7b350c74d353
Date: 2018-08-06 21:59 -0700
http://bitbucket.org/pypy/pypy/changeset/7b350c74d353/
Log: remove unicode conversions
diff --git a/pypy/interpreter/test/test_argument.py
b/pypy/interpreter/test/test_argument.py
--- a/pypy/interpreter/test/test_argument.py
+++ b/pypy/interpreter/test/test_argument.py
@@ -134,7 +134,7 @@
def type(self, obj):
class Type:
def getname(self, space):
- return unicode(type(obj).__name__)
+ return type(obj).__name__
return Type()
diff --git a/pypy/module/_cppyy/interp_cppyy.py
b/pypy/module/_cppyy/interp_cppyy.py
--- a/pypy/module/_cppyy/interp_cppyy.py
+++ b/pypy/module/_cppyy/interp_cppyy.py
@@ -597,7 +597,7 @@
def getname(self, space):
# for the benefit of Method/instancemethod
- return capi.c_method_name(space,
self.functions[0].cppmethod).decode('latin-1')
+ return capi.c_method_name(space, self.functions[0].cppmethod)
def __repr__(self):
return "W_CPPOverload(%s)" % [f.prototype() for f in self.functions]
@@ -832,7 +832,7 @@
return self.getitem_impl(self.name, args_w)
def getname(self, space):
- return self.name.decode('latin-1')
+ return self.name
def __repr__(self):
return "W_CPPTemplateOverload(%s)" % [f.prototype() for f in
self.functions]
@@ -890,7 +890,7 @@
return self.getitem_impl(self.name, args_w)
def getname(self, space):
- return self.name.decode('latin-1')
+ return self.name
def __repr__(self):
return "W_CPPTemplateStaticOverload(%s)" % [f.prototype() for f in
self.functions]
diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -849,7 +849,7 @@
haslf = True
if haslf and self.writetranslate and self.writenl:
w_text = space.call_method(w_text, "replace", space.newutf8('\n',
1),
- space.newutf8(self.writenl,
get_utf8_length(self.writenl)))
+ space.newutf8(self.writenl,
get_utf8_length(self.writenl)))
text = space.utf8_w(w_text)
needflush = False
diff --git a/pypy/module/_lsprof/interp_lsprof.py
b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -207,13 +207,12 @@
if isinstance(w_type, W_TypeObject):
w_realclass, _ = space.lookup_in_type_where(w_type, name)
if isinstance(w_realclass, W_TypeObject):
- class_name = w_realclass.name.decode('utf-8')
+ class_name = w_realclass.name
else:
name = '?'
if class_name is None:
class_name = w_type.getname(space) # if the rest doesn't work
- return u"<method '%s' of '%s' objects>" % (name.decode('utf-8'),
- class_name)
+ return b"<method '%s' of '%s' objects>" % (name, class_name)
def create_spec_for_function(space, w_func):
diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -105,7 +105,7 @@
def repr_w(self):
space = self.space
- u = space.realunicode_w(space.repr(self.w_pattern))
+ u = space.utf8_w(space.repr(self.w_pattern))
if len(u) > 200:
u = u[:200]
flag_items = []
diff --git a/pypy/module/_warnings/interp_warnings.py
b/pypy/module/_warnings/interp_warnings.py
--- a/pypy/module/_warnings/interp_warnings.py
+++ b/pypy/module/_warnings/interp_warnings.py
@@ -271,11 +271,11 @@
if not line:
return
- message = u"\n"
+ message = "\n"
for i in range(len(line)):
c = line[i]
- if c not in u' \t\014':
- message = u" %s\n" % (line[i:],)
+ if c not in ' \t\014':
+ message = " %s\n" % (line[i:],)
break
space.call_method(w_stderr, "write", space.newtext(message))
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -82,7 +82,7 @@
return w_some_obj()
def getname(self, space):
- return self.name.decode('utf-8')
+ return self.name
def w_some_obj():
if NonConstant(False):
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
@@ -401,7 +401,7 @@
return self.newtext(s)
# XXX find where length is annotated as negative int
- @signature(types.any(), types.str(), types.int_nonneg(),
returns=types.any())
+ #@signature(types.any(), types.str(), types.int_nonneg(),
returns=types.any())
def newutf8(self, utf8s, length):
assert isinstance(utf8s, str)
return W_UnicodeObject(utf8s, length)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit