Author: fijal Branch: unicode-utf8 Changeset: r93309:affb72fc7cf7 Date: 2017-12-08 10:40 +0200 http://bitbucket.org/pypy/pypy/changeset/affb72fc7cf7/
Log: fix _multibytecodec diff --git a/pypy/module/_multibytecodec/c_codecs.py b/pypy/module/_multibytecodec/c_codecs.py --- a/pypy/module/_multibytecodec/c_codecs.py +++ b/pypy/module/_multibytecodec/c_codecs.py @@ -157,7 +157,7 @@ replace, end = errorcb(errors, namecb, reason, stringdata, start, end) # 'replace' is RPython unicode here - lgt, _ = rutf8.check_utf8(replace, True) + lgt = rutf8.get_utf8_length(replace) inbuf = rffi.utf82wcharp(replace, lgt) try: r = pypy_cjk_dec_replace_on_error(decodebuf, inbuf, lgt, end) @@ -268,7 +268,7 @@ rets, end = errorcb(errors, namecb, reason, unicodedata, start, end) codec = pypy_cjk_enc_getcodec(encodebuf) - lgt, _ = rutf8.get_utf8_length_flag(rets) + lgt = rutf8.get_utf8_length(rets) replace = encode(codec, rets, lgt, "strict", errorcb, namecb) with rffi.scoped_nonmovingbuffer(replace) as inbuf: r = pypy_cjk_enc_replace_on_error(encodebuf, inbuf, len(replace), end) diff --git a/pypy/module/_multibytecodec/interp_incremental.py b/pypy/module/_multibytecodec/interp_incremental.py --- a/pypy/module/_multibytecodec/interp_incremental.py +++ b/pypy/module/_multibytecodec/interp_incremental.py @@ -66,7 +66,7 @@ pos = c_codecs.pypy_cjk_dec_inbuf_consumed(self.decodebuf) assert 0 <= pos <= len(object) self.pending = object[pos:] - lgt = rutf8.get_utf8_length_flag(output) + lgt = rutf8.get_utf8_length(output) return space.newutf8(output, lgt) diff --git a/pypy/module/_multibytecodec/interp_multibytecodec.py b/pypy/module/_multibytecodec/interp_multibytecodec.py --- a/pypy/module/_multibytecodec/interp_multibytecodec.py +++ b/pypy/module/_multibytecodec/interp_multibytecodec.py @@ -27,8 +27,8 @@ raise wrap_unicodedecodeerror(space, e, input, self.name) except RuntimeError: raise wrap_runtimeerror(space) - lgt, flag = rutf8.check_utf8(utf8_output, True) - return space.newtuple([space.newutf8(utf8_output, lgt, flag), + lgt = rutf8.get_utf8_length(utf8_output) + return space.newtuple([space.newutf8(utf8_output, lgt), space.newint(len(input))]) @unwrap_spec(errors="text_or_none") diff --git a/pypy/module/_multibytecodec/test/test_translation.py b/pypy/module/_multibytecodec/test/test_translation.py --- a/pypy/module/_multibytecodec/test/test_translation.py +++ b/pypy/module/_multibytecodec/test/test_translation.py @@ -14,7 +14,7 @@ codecname, string = argv[1], argv[2] c = c_codecs.getcodec(codecname) u = c_codecs.decode(c, string) - lgt, _ = rutf8.get_utf8_length_flag(u) + lgt = rutf8.get_utf8_length(u) r = c_codecs.encode(c, u, lgt) print r return 0 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit