Author: Armin Rigo <[email protected]>
Branch: unicode-utf8
Changeset: r92256:bc374de6e273
Date: 2017-08-24 17:24 +0200
http://bitbucket.org/pypy/pypy/changeset/bc374de6e273/

Log:    (fijal, arigo)

        Tweaks

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
@@ -41,7 +41,7 @@
         self._length = length
         self._ucs4 = ucs4str
         if not we_are_translated():
-            assert rutf8.check_utf8(utf8str) == length
+            assert rutf8.check_utf8(utf8str, allow_surrogates=True) == length
 
     def __repr__(self):
         """representation for debugging purposes"""
@@ -845,12 +845,11 @@
             return space.newutf8(s, len(s))
         if encoding == 'utf-8':
             s = space.charbuf_w(w_obj)
-            eh = unicodehelper.decode_error_handler(space)
             try:
-                _, lgt = rutf8.str_check_utf8(s, len(s), final=True,
-                                              allow_surrogates=True)
+                lgt = rutf8.check_utf8(s, allow_surrogates=True)
             except rutf8.CheckError:
                 XXX
+                eh = unicodehelper.decode_error_handler(space)
                 eh(None, 'utf8', e.msg, s, e.startpos, e.endpos)
                 assert False, "has to raise"
             return space.newutf8(s, lgt)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to