[pypy-commit] pypy unicode-utf8: fix unicode \-encoding in _pypyjson

cfbolz pypy.commits at gmail.com
Fri Nov 24 08:00:45 EST 2017


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: unicode-utf8
Changeset: r93159:82223a975b6b
Date: 2017-11-24 13:00 +0100
http://bitbucket.org/pypy/pypy/changeset/82223a975b6b/

Log:	fix unicode \-encoding in _pypyjson

diff --git a/pypy/module/_pypyjson/interp_decoder.py b/pypy/module/_pypyjson/interp_decoder.py
--- a/pypy/module/_pypyjson/interp_decoder.py
+++ b/pypy/module/_pypyjson/interp_decoder.py
@@ -369,8 +369,7 @@
             return # help the annotator to know that we'll never go beyond
                    # this point
         #
-        uchr = runicode.code_to_unichr(val)     # may be a surrogate pair again
-        utf8_ch = unicodehelper.encode_utf8(self.space, uchr)
+        utf8_ch = rutf8.unichr_as_utf8(val, allow_surrogates=True)
         builder.append(utf8_ch)
         return i
 


More information about the pypy-commit mailing list