Author: Matti Picus <matti.pi...@gmail.com> Branch: py3.5 Changeset: r96008:a66a6d79084f Date: 2019-02-14 00:30 +0200 http://bitbucket.org/pypy/pypy/changeset/a66a6d79084f/
Log: backport 3.6 changes diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py --- a/pypy/interpreter/unicodehelper.py +++ b/pypy/interpreter/unicodehelper.py @@ -136,11 +136,12 @@ from pypy.module._codecs import interp_codecs state = space.fromcache(interp_codecs.CodecState) unicodedata_handler = state.get_unicodedata_handler(space) - return str_decode_unicode_escape( + s, blen, ulen, first_escape_error_char = str_decode_unicode_escape( string, "strict", final=True, errorhandler=state.decode_error_handler, ud_handler=unicodedata_handler) + return s, blen, ulen def decode_raw_unicode_escape(space, string): return str_decode_raw_unicode_escape( @@ -501,10 +502,11 @@ def str_decode_unicode_escape(s, errors, final, errorhandler, ud_handler): size = len(s) if size == 0: - return '', 0, 0 + return '', 0, 0, None builder = rutf8.Utf8StringBuilder(size) pos = 0 + first_escape_error_char = None while pos < size: ch = s[pos] @@ -619,8 +621,9 @@ else: builder.append_char('\\') builder.append_code(ord(ch)) + first_escape_error_char = ch - return builder.build(), builder.getlength(), pos + return builder.build(), builder.getlength(), pos, first_escape_error_char def wcharpsize2utf8(space, wcharp, size): """Safe version of rffi.wcharpsize2utf8. diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py --- a/pypy/module/_codecs/interp_codecs.py +++ b/pypy/module/_codecs/interp_codecs.py @@ -960,7 +960,7 @@ unicode_name_handler = state.get_unicodedata_handler(space) - result, lgt, u_len = unicodehelper.str_decode_unicode_escape( + result, lgt, u_len, first_escape_error_char = unicodehelper.str_decode_unicode_escape( string, errors, final, state.decode_error_handler, unicode_name_handler) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit