[pypy-commit] pypy unicode-utf8-py3: do not re-encode in surrogateescape (is this correct?)

mattip pypy.commits at gmail.com
Thu Nov 1 12:19:31 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95269:db15a8ce07d7
Date: 2018-11-01 18:18 +0200
http://bitbucket.org/pypy/pypy/changeset/db15a8ce07d7/

Log:	do not re-encode in surrogateescape (is this correct?)

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
@@ -1224,6 +1224,9 @@
                 # surrogatepass?
                 break 
             pos = _pos
+        if errors == 'surrogateescape':
+            #escape
+            return space.newbytes(utf8)
         w_object = space.newtext(utf8)
     if errors is None or errors == 'strict':
         if encoding is None or encoding == 'utf-8':


More information about the pypy-commit mailing list