[pypy-commit] pypy default: revert part of 4e661aec658f to keep synced with py3.6

mattip pypy.commits at gmail.com
Sun Feb 17 09:54:02 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r96042:d13ae7d283ae
Date: 2019-02-17 16:53 +0200
http://bitbucket.org/pypy/pypy/changeset/d13ae7d283ae/

Log:	revert part of 4e661aec658f to keep synced with py3.6

diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -21,7 +21,7 @@
                                              space.newtext(msg)]))
     return raise_unicode_exception_decode
 
-def decode_never_raise(errors, encoding, msg, s, startingpos, endingpos):
+def _decode_never_raise(errors, encoding, msg, s, startingpos, endingpos):
     assert startingpos >= 0
     ux = ['\ux' + hex(ord(x))[2:].upper() for x in s[startingpos:endingpos]]
     return ''.join(ux), endingpos, 'b'
@@ -918,6 +918,13 @@
 
     return result.build()
 
+def decode_utf8sp(space, string):
+    # Surrogate-preserving utf-8 decoding.  Assuming there is no
+    # encoding error, it should always be reversible, and the reverse is
+    # encode_utf8sp().
+    return str_decode_utf8(string, "string", True, _decode_never_raise,
+                           allow_surrogates=True)
+
 # ____________________________________________________________
 # utf-16
 


More information about the pypy-commit mailing list