[pypy-commit] pypy unicode-utf8-py3: start to replace s.encode('utf8') with calls to unicode_encode_utf_8
mattip
pypy.commits at gmail.com
Thu Aug 9 16:30:47 EDT 2018
Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r94986:3125af5a0967
Date: 2018-08-09 13:29 -0700
http://bitbucket.org/pypy/pypy/changeset/3125af5a0967/
Log: start to replace s.encode('utf8') with calls to unicode_encode_utf_8
diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -6,10 +6,10 @@
from rpython.rlib import jit
from rpython.rlib.objectmodel import enforceargs
from rpython.rlib.rstring import StringBuilder
+from rpython.rlib.runicode import unicode_encode_utf_8
from pypy.interpreter.error import OperationError, oefmt
-
class Arguments(object):
"""
Collects the arguments of a function call.
@@ -603,7 +603,8 @@
def getmsg(self):
if self.num_kwds == 1:
if isinstance(self.kwd_name, unicode):
- uname = self.kwd_name.encode('utf8')
+ uname = unicode_encode_utf_8(self.kwd_name, len(self.kwd_name),
+ 'strict', allow_surroagates=False)
else:
uname = self.kwd_name
msg = "got an unexpected keyword argument '%s'" % uname
More information about the pypy-commit
mailing list