[pypy-commit] pypy unicode-utf8: fix pyexpat

fijal pypy.commits at gmail.com
Sat Oct 28 05:56:44 EDT 2017


Author: fijal
Branch: unicode-utf8
Changeset: r92862:44cd30c7b69a
Date: 2017-10-28 11:56 +0200
http://bitbucket.org/pypy/pypy/changeset/44cd30c7b69a/

Log:	fix pyexpat

diff --git a/pypy/module/pyexpat/interp_pyexpat.py b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -478,12 +478,14 @@
             # I suppose this is a valid utf8, but there is noone to check
             # and noone to catch an error either
             try:
-                rutf8.str_check_utf8(s, len(s), final=True)
-                return space.newutf8(s, -1)
-            except rutf8.Utf8CheckError as e:
+                lgt = rutf8.check_utf8(s, True)
+                return space.newutf8(s, lgt)
+            except rutf8.CheckError:
                 from pypy.interpreter import unicodehelper
-                unicodehelper.decode_error_handler(space)('strict', 'utf-8',
-                    e.msg, s, e.startpos, e.endpos)
+                # get the correct error msg
+                unicodehelper.str_decode_utf8(s, len(s), 'string', True,
+                    unicodehelper.decode_error_handler(space))
+                assert False, "always raises"
         else:
             return space.newtext(s)
 


More information about the pypy-commit mailing list