[pypy-commit] pypy unicode-utf8-py3: fix incremental encoding

mattip pypy.commits at gmail.com
Mon Oct 29 17:49:59 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95261:39a87d168b67
Date: 2018-10-29 23:48 +0200
http://bitbucket.org/pypy/pypy/changeset/39a87d168b67/

Log:	fix incremental encoding

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
@@ -766,8 +766,9 @@
     res, lgt, pos, bo = str_decode_utf_16_helper(
         data, errors, final,
         state.decode_error_handler, _byteorder)
+    # return result, consumed, byteorder for buffered incremental encoders
     return space.newtuple([space.newutf8(res, lgt),
-                           space.newint(lgt), space.newint(bo)])
+                           space.newint(pos), space.newint(bo)])
 
 @unwrap_spec(data='bufferstr', errors='text_or_none', byteorder=int,
              w_final=WrappedDefault(False))
@@ -785,8 +786,9 @@
     res, lgt, pos, bo = str_decode_utf_32_helper(
         data, errors, final,
         state.decode_error_handler, _byteorder)
+    # return result, consumed, byteorder for buffered incremental encoders
     return space.newtuple([space.newutf8(res, lgt),
-                           space.newint(lgt), space.newint(bo)])
+                           space.newint(pos), space.newint(bo)])
 
 # ____________________________________________________________
 # Charmap


More information about the pypy-commit mailing list