summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs/multibytecodec.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/cjkcodecs/multibytecodec.c')
-rw-r--r--Modules/cjkcodecs/multibytecodec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 56251f3..1f31595 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -498,7 +498,6 @@ multibytecodec_encode(MultibyteCodec *codec,
outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf);
r = codec->encode(state, codec->config, &buf.inbuf, inleft,
&buf.outbuf, outleft, flags);
- *data = buf.inbuf;
if ((r == 0) || (r == MBERR_TOOFEW && !(flags & MBENC_FLUSH)))
break;
else if (multibytecodec_encerror(codec, state, &buf, errors,r))
@@ -528,6 +527,7 @@ multibytecodec_encode(MultibyteCodec *codec,
if (_PyString_Resize(&buf.outobj, finalsize) == -1)
goto errorexit;
+ *data = buf.inbuf;
Py_XDECREF(buf.excobj);
return buf.outobj;