Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8-py3 Changeset: r94844:ad7718874721 Date: 2018-07-11 06:44 -0700 http://bitbucket.org/pypy/pypy/changeset/ad7718874721/
Log: revert some of 2621c0f70d91, avoid decoding utf8 -> unicode diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py --- a/pypy/interpreter/argument.py +++ b/pypy/interpreter/argument.py @@ -602,8 +602,11 @@ def getmsg(self): if self.num_kwds == 1: - msg = u"got an unexpected keyword argument '%s'" % ( - self.kwd_name.decode('utf8')) + if isinstance(self.kwd_name, str): + uname = self.kwd_name.decode('utf8') + else: + uname = self.kwd_name + msg = u"got an unexpected keyword argument '%s'" % uname else: msg = "got %d unexpected keyword arguments" % ( self.num_kwds) diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py --- a/pypy/module/_codecs/interp_codecs.py +++ b/pypy/module/_codecs/interp_codecs.py @@ -638,7 +638,7 @@ state = space.fromcache(CodecState) utf8len = w_arg._length # XXX deal with func() returning length or not - result = func(w_arg._utf8.decode('utf8'), errors, state.encode_error_handler) + result = func(w_arg._utf8, errors, state.encode_error_handler) return space.newtuple([space.newbytes(result.encode('utf8')), space.newint(utf8len)]) wrap_encoder.__name__ = func.__name__ globals()[name] = wrap_encoder diff --git a/pypy/objspace/std/test/test_dictmultiobject.py b/pypy/objspace/std/test/test_dictmultiobject.py --- a/pypy/objspace/std/test/test_dictmultiobject.py +++ b/pypy/objspace/std/test/test_dictmultiobject.py @@ -1290,7 +1290,7 @@ def text_w(self, u): assert isinstance(u, unicode) - return FakeUnicode(u) + return FakeUnicode(u).encode('utf8') def bytes_w(self, string): assert isinstance(string, str) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit