[pypy-commit] pypy unicode-utf8: Translation fixes. The 'fix' in unicodeobject merely shows the next problem

arigo pypy.commits at gmail.com
Sat Oct 14 09:37:38 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: unicode-utf8
Changeset: r92756:a5262fe7cebf
Date: 2017-10-14 15:37 +0200
http://bitbucket.org/pypy/pypy/changeset/a5262fe7cebf/

Log:	Translation fixes. The 'fix' in unicodeobject merely shows the next
	problem

diff --git a/pypy/module/_multibytecodec/c_codecs.py b/pypy/module/_multibytecodec/c_codecs.py
--- a/pypy/module/_multibytecodec/c_codecs.py
+++ b/pypy/module/_multibytecodec/c_codecs.py
@@ -264,7 +264,7 @@
         else:
             assert retu is not None
             codec = pypy_cjk_enc_getcodec(encodebuf)
-            replace = encode(codec, retu.decode("utf8"), "strict", errorcb, namecb)
+            replace = encode(codec, retu, "strict", errorcb, namecb)
     with rffi.scoped_nonmovingbuffer(replace) as inbuf:
         r = pypy_cjk_enc_replace_on_error(encodebuf, inbuf, len(replace), end)
     if r == MBERR_NOMEMORY:
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -663,7 +663,7 @@
         if space.isinstance_w(w_prefix, space.w_unicode):
             self_as_unicode = unicode_from_encoded_object(space, self, None,
                                                           None)
-            return self_as_unicode._startswith(space, self_as_unicode._utf8.decode("utf8"),
+            return self_as_unicode._startswith(space, self_as_unicode._utf8,
                                                w_prefix, start, end)
         return self._StringMethods__startswith(space, value, w_prefix, start,
                                                end)
@@ -673,7 +673,7 @@
         if space.isinstance_w(w_suffix, space.w_unicode):
             self_as_unicode = unicode_from_encoded_object(space, self, None,
                                                           None)
-            return self_as_unicode._endswith(space, self_as_unicode._utf8.decode("utf8"),
+            return self_as_unicode._endswith(space, self_as_unicode._utf8,
                                              w_suffix, start, end)
         return self._StringMethods__endswith(space, value, w_suffix, start,
                                              end)
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
@@ -114,6 +114,7 @@
         return space.newint(rutf8.codepoint_at_pos(self._utf8, 0))
 
     def _new(self, value):
+        assert isinstance(value, unicode)
         return W_UnicodeObject(value.encode('utf8'), len(value))
 
     def _new_from_list(self, value):


More information about the pypy-commit mailing list